Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

How to delete an image from an image field

annabforum
Level 1
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
mouslander
Level 7
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

radzmar
Level 10
Level 10

Hi,

you can delete the image data via script.


Imagefield.rawValue = null;


mouslander
Level 7
Level 7

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

annabforum
Level 1
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!