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

Clear form button not working on IPad

New Here ,
Oct 15, 2021 Oct 15, 2021

I have a button that clears all information on the form and gives the user a warning before they can clear the form.  The button works on the Macbook Pro however it does not work on the iPad.  The picture below is the message that I'm getting on the iPad when I press the "Clear Form" button.  The version of Acbrobat Reader on the iPad is 21.09.01.

 

IMG_0002.PNGexpand image

 

Below is the code that I'm using on the Mouse Down action.  I don't necessarily need to offer the user to save the file, however I would like to give the user a warning message before they commit to clearing the form.

 

// A MouseUp action

var nButton1 = app.alert({

cTitle: "HOW TO SAVE THIS DOCUMENT AND CLEAR THE FORM",

cMsg: "STOP! DO NOT CLEAR THIS FORM UNLESS YOU SAVE IT FIRST. \r\rIf you have not saved this document yet go ahead and click NO to save now, otherwise click YES to clear this form. \r\rWould you like to proceed and clear this form now?", 

nIcon: 4, nType: 2

});

//if user clicks on YES button it will alert the user that it will reset and ask YES or NO to proceed

if ( nButton1 == 4 ) {

// clear and reset all the fields objects in this document
this.resetForm();

} else {

//if user clicks NO button it will alert user with instructions on how to save document

var nButton2 = app.alert({

cTitle: "SAVE THIS FORM",

cMsg: "This document will Save now.\r\rSave this form under Last Name, First Name - Date",

nIcon: 4, nType: 1

});

if ( nButton2 == 1) {

app.execMenuItem("SaveAs");

  }
}

 

 

TOPICS
How to , JavaScript , PDF forms
2.1K
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 ,
Oct 15, 2021 Oct 15, 2021

The mobile version of Reader has almost no support for scripts, unfortunately. You should try PDF Expert by Readdle. It has a better chance of working there.

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 ,
Oct 15, 2021 Oct 15, 2021

The mobile version of Reader has almost no support for scripts, unfortunately. You should try PDF Expert by Readdle. It has a better chance of working 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 ,
Oct 17, 2021 Oct 17, 2021

I downloaded PDF Expert and it worked.  Thanks for the help.

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
Explorer ,
Aug 03, 2022 Aug 03, 2022

I'm having trouble getting the save part of this script to work even in PDF Expert. Any suggestions?

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 ,
Aug 04, 2022 Aug 04, 2022

Report the issue to Readdle, the developers of PDF Expert.

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 ,
Aug 04, 2022 Aug 04, 2022

Unfortunately there is no save option in the script.  This script is just a warning to the user that they need to save the form before they clear the form.

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
Explorer ,
Aug 04, 2022 Aug 04, 2022

Yeah, this was the part not working:

app.execMenuItem("SaveAs");
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 ,
Aug 04, 2022 Aug 04, 2022

Below is what I ended up doing because I'm thinking that I was having the same problem as you.

 

// A MouseUp action

var nButton1 = app.alert({

cTitle: "WARNING!!!! WARNING!!!!",

cMsg: "STOP! DO NOT CLEAR THIS FORM UNLESS YOU HAVE SAVED IT FIRST. \r\rIf you have not saved this document yet go ahead and click NO and save the form, otherwise click YES to clear this form. \r\rWould you like to proceed and clear this form now?", 

nIcon: 4, nType: 2

});


//if user clicks on YES button it will alert the user that it will reset and ask YES or NO to proceed

if ( nButton1 == 4 ) {

// clear and reset all the fields objects in this document
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
Explorer ,
Aug 04, 2022 Aug 04, 2022

I think that is basically what I ended up with as well.  One question...I've noticed every script posted in the forums has the nButton variable set for app.alert boxes, but most of mine work just fine without setting that variable. Is it absolutely necessary in all cases to set that variable? and why?

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 ,
Aug 04, 2022 Aug 04, 2022

I am not the best for that question because I have limited knowledge.  Sorry I couldn't be of more help.

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 ,
Aug 04, 2022 Aug 04, 2022
LATEST

A function can have mandatory parameters, and optional ones. If you don't specify the value of an optional one it will still work, using a default value for it.

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