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

Need javascript for button to set all fields to read only with pop up prompt

New Here ,
Mar 18, 2020 Mar 18, 2020

Copy link to clipboard

Copied

Hi, 

As a newbie, I'm stuck.  

This is as far as I could get in setting up a "Done" button to lock all the fields as read only.

 

for (var i = 0; i < this.numFields; i++)

{

if (app.alert({nType:2,nIcon:2,cMsg:"This will lock the document for printing and email submission. Are you sure you want to continue?"})==4)

{

this.getField(getNthFieldName(i)).readonly=true;

}

else

{

}}

 

The pop up works, but the script hangs up at the pop up window and I have to Force Quit the app.  I can get the fields to set to read only without the pop up, however the folks using this form will need to understand the consquences. of selecting the "Done" button.

TOPICS
Acrobat SDK and JavaScript

Views

383

Translate

Translate

Report

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 ,
Mar 18, 2020 Mar 18, 2020

Copy link to clipboard

Copied

Move the if before the for.

Votes

Translate

Translate

Report

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 ,
Mar 18, 2020 Mar 18, 2020

Copy link to clipboard

Copied

Thank you Bernd!   Sadly, as a newbie, simply moving the "if" before the "for" results in a snytax error I cannot resolve. 

Votes

Translate

Translate

Report

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 ,
Mar 18, 2020 Mar 18, 2020

Copy link to clipboard

Copied

LATEST

Considered your suggestion in a broader sense, then moved the script around a bit (logically) and bingo!

 

Thank you!

Votes

Translate

Translate

Report

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