Highlighted

How to check the value of multiple check boxes when closing acrobat

Community Beginner ,
Oct 14, 2020

Copy link to clipboard

Copied

I would like to perform a check whenever the pdf is closed and display an alert if one of the check boxes in the document is not ticked.

My problem is that the validity of certain textboxes should be checked in connection with the value selected in a specific radio button. 

I thought to use this code in Document will close, but i think i got the syntax wrong, as I get an error.

if(

this.getField("CheckBox1").value == "Off" ||

(this.getField("RadioButton").value == "Choice1" && this.getField("CheckBox2").value == "Off")

) {

app.alert("Not all check boxes are ticked!",3,0, "Attention!");

}

 

What should I change?

Thanks!

 

 

TOPICS
Create PDFs, Edit and convert PDFs, How to, PDF forms

Views

76

Likes

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

How to check the value of multiple check boxes when closing acrobat

Community Beginner ,
Oct 14, 2020

Copy link to clipboard

Copied

I would like to perform a check whenever the pdf is closed and display an alert if one of the check boxes in the document is not ticked.

My problem is that the validity of certain textboxes should be checked in connection with the value selected in a specific radio button. 

I thought to use this code in Document will close, but i think i got the syntax wrong, as I get an error.

if(

this.getField("CheckBox1").value == "Off" ||

(this.getField("RadioButton").value == "Choice1" && this.getField("CheckBox2").value == "Off")

) {

app.alert("Not all check boxes are ticked!",3,0, "Attention!");

}

 

What should I change?

Thanks!

 

 

TOPICS
Create PDFs, Edit and convert PDFs, How to, PDF forms

Views

77

Likes

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
Oct 14, 2020 0
Adobe Community Professional ,
Oct 14, 2020

Copy link to clipboard

Copied

What error does you get?

Likes

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
Reply
Loading...
Oct 14, 2020 0
Community Beginner ,
Oct 14, 2020

Copy link to clipboard

Copied

It just says "Syntax Error: syntax error 8"

Likes

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
Reply
Loading...
Oct 14, 2020 0
Adobe Community Professional ,
Oct 15, 2020

Copy link to clipboard

Copied

Try this:

Execute the script in the Javascript console.

Likes

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
Reply
Loading...
Oct 15, 2020 0
Community Beginner ,
Oct 19, 2020

Copy link to clipboard

Copied

Thank you! It appears that I was using too many ||, and not enough ), but it works correctly now.

The other problem I got into now is that my code is 104000 characters long and it does not fit in the Java Script Editor. Is there any workaround that? 

Likes

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
Reply
Loading...
Oct 19, 2020 0
Adobe Community Professional ,
Oct 19, 2020

Copy link to clipboard

Copied

You can use a external text editor

Likes

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
Reply
Loading...
Oct 19, 2020 0