Check all checkbox code

New Here ,
Feb 06, 2018

Copy link to clipboard

Copied

Hi all,

I'm a coding noob and can do basic stuff but I can not for the life of me figure out how to code a check box (checkall) to select yes on 20 or so radio buttons (radio1-20)for marking rather than having to select each one. But I still need to be able to change some individual radio buttons to no  and if unselected clear all radiobox if required. Can someone point me in the right direction. I assume I need to create an array and code on a mouse up for the check box. Just not sure how to proceed.

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

Use a button Mouse Up Script.  The easiest solution is to prefix all the radio button names with something like "Group1.".  The "dot" at the end is critical. This groups the fields so they can be handled as a group. Next, make sure all the Yes buttons have an export value of "Yes". Now put this code in the button script

this.getField("Group1").getArray().forEach(function(a){a.value = "Yes";});

TOPICS
Acrobat SDK and JavaScript, Windows

Views

82

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

Check all checkbox code

New Here ,
Feb 06, 2018

Copy link to clipboard

Copied

Hi all,

I'm a coding noob and can do basic stuff but I can not for the life of me figure out how to code a check box (checkall) to select yes on 20 or so radio buttons (radio1-20)for marking rather than having to select each one. But I still need to be able to change some individual radio buttons to no  and if unselected clear all radiobox if required. Can someone point me in the right direction. I assume I need to create an array and code on a mouse up for the check box. Just not sure how to proceed.

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

Use a button Mouse Up Script.  The easiest solution is to prefix all the radio button names with something like "Group1.".  The "dot" at the end is critical. This groups the fields so they can be handled as a group. Next, make sure all the Yes buttons have an export value of "Yes". Now put this code in the button script

this.getField("Group1").getArray().forEach(function(a){a.value = "Yes";});

TOPICS
Acrobat SDK and JavaScript, Windows

Views

83

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
Feb 06, 2018 0
Adobe Community Professional ,
Feb 06, 2018

Copy link to clipboard

Copied

Use a button Mouse Up Script.  The easiest solution is to prefix all the radio button names with something like "Group1.".  The "dot" at the end is critical. This groups the fields so they can be handled as a group. Next, make sure all the Yes buttons have an export value of "Yes". Now put this code in the button script

this.getField("Group1").getArray().forEach(function(a){a.value = "Yes";});

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...
Feb 06, 2018 0
New Here ,
Feb 08, 2018

Copy link to clipboard

Copied

Thank you!

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...
Feb 08, 2018 0