Expand my Community achievements bar.

How to delete an image from an image field

Avatar

Level 1

I have created a form in LC ES4. It contains an image field. Once an image is inserted, it seems it cannot be deleted. Does anyone know how to fix this issue?

I appreciate any advice!

4 Replies

Avatar

Level 7

Under what condition does it need to be deleted? You cannot just click on an image field and hit delete like you would in a text field by selecting the text and hitting delete.

2 options come to mind to resolve this issue:

1- you can have an on Enter event that will clear the field. For example I have a profile form and I want to add my photo. I click the first time and select the photo. I decide I do not like it and I click back into the image field and it clears the field and allows me to select a new picture.

The down fall to this is that a user can overwrite their image

2- you can have a clear button assigned to the image field and use that to delete the image. You can set the button to be screen view only

Avatar

Level 10

Hi,

you can delete the image data via script.


Imagefield.rawValue = null;


Avatar

Level 7

That will work but you need a trigger to do that something like a button for an end user to interact with.

Avatar

Level 1

Thank you. Although this does get rid of the image, it seems to then render the image field unable to insert another image at a later date. The Image field header remains, but the field itself (when you would click to activate the 'select image from file' activity) disappears. I appreaciate your input, everyone!