Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Reset a form button confirmation pop up window not working

New Here ,
Feb 06, 2018 Feb 06, 2018

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.

TOPICS
PDF forms
5.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Feb 06, 2018 Feb 06, 2018

You have to do it all in JS. You can't add a separate command to reset the form, as that will always execute.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2018 Feb 06, 2018

You have to do it all in JS. You can't add a separate command to reset the form, as that will always execute.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 06, 2018 Feb 06, 2018

I guess I should have mentioned my beginner skills.  Thank you for pointing that out!!!! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2018 Feb 06, 2018

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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 06, 2020 Jan 06, 2020

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2020 Jan 06, 2020

I see you already got a reply in your stand-alone post. Let's continue the discussion there.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 09, 2020 Dec 09, 2020

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 09, 2020 Dec 09, 2020
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 18, 2020 Dec 18, 2020
LATEST

That was what I was looking for. Worked perfectly, thank you very much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines