Expand my Community achievements bar.

How do I clear an image without clearing a whole form?

Avatar

Level 1

I have a template made up that is strictly for adding photos and a little write up about them. I know the reset button will clear all the images but my issue is if a photo is added to a image field and they want to delete it out they can only reset the whole form or just add a blank photo. I know nothing about scripts but I did see something where if you held down shift  and clicked the picture it would go away??? PLEASE HELP!!

1 Reply

Avatar

Level 7

Easy. Create a button for removing the image

Give the click event for the button the code below:

ImageField1.rawValue = null;

Here is another tip in case you want to reset the form but keep the images.

Create a Reset Button and give the click event the code below:

//this code stores the image in a variable, resets the form and puts it back. Effectively not resetting the imagefield
var img; //create variable
img = ImageField1.rawValue; //give the variable the image that is in the ImageField

xfa.host.resetData(); //reset the form

ImageField1.rawValue = img; //restore the image field to the value(image) held in the variable.

1298434_pastedImage_1.png