Copy link to clipboard
Copied
I have reset form buttons on most of my forms and am trying to add a confirmation pop up that asks if they are sure they want to reset the form.
By clicking cancel or no - the form should still contain the data that was in it, if they click yes it should erase all the form fields.
On the action tab of the button properties, I have added the action to run a javascript - and tried numerous scripts found online, moved it above the reset a form action and below. Most all will pop up, but regardless of what is pressed, the form clears out.
I want the option to NOT clear the form after it has been pressed but giving the "second chance" warning pop up and I wouldn't mind dictating what the message says - but that isn't near as important as the action working.
Copy link to clipboard
Copied
You have to do it all in JS. You can't add a separate command to reset the form, as that will always execute.
Copy link to clipboard
Copied
You have to do it all in JS. You can't add a separate command to reset the form, as that will always execute.
Copy link to clipboard
Copied
I guess I should have mentioned my beginner skills. Thank you for pointing that out!!!!
Copy link to clipboard
Copied
In case you need the code to do it, it would be something like this:
if (app.alert("Are you sure you want to clear this form?",2,2)==4) this.resetForm();
Copy link to clipboard
Copied
I used this JS and it works great. However, when the user selects "No" it clears the form anyway. How do I get it to not do that?
Copy link to clipboard
Copied
I see you already got a reply in your stand-alone post. Let's continue the discussion there.
Copy link to clipboard
Copied
Was there a resolution on this? Because I am running into the same problem of the form still clearing when "No" is selected with the JS code you provided.
Copy link to clipboard
Copied
Check my original post here https://community.adobe.com/t5/acrobat-sdk/reset-a-form-need-help-with-javascript/td-p/10838723
Copy link to clipboard
Copied
That was what I was looking for. Worked perfectly, thank you very much!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more