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

Click multiple radio buttons with a single button

Community Beginner ,
Feb 01, 2023 Feb 01, 2023

Copy link to clipboard

Copied

I'm using Acrobat to build an interactive grading rubric. I feel good about what I have so far. Each grading criterion has three tiers, +4, +3, and +1. It's set up so the selected values will automatically add to the final score.

 

Now what I want to do is put in a button that will select all the +4 options. I've built a custom button that's labeled "Full Marks", but I need to know how to code it so it will select all the +4 radio buttons.

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

642

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

correct answers 1 Correct answer

Community Expert , Feb 02, 2023 Feb 02, 2023

When writing code, it is required to used exact values. So, so write the script you want, we have to know the exact names of the radio button groups and the exact export values. In one post you say the exports are (4,3,1) and in the next you say the export is "+4".  The export is a string value, not a number. So we have to know the exact text used.  For your calculations, the exports are converted to a number, but for checking a button, the string value is needed. 

 

For this example I'll assume

...

Votes

Translate

Translate
Community Expert ,
Feb 01, 2023 Feb 01, 2023

Copy link to clipboard

Copied

Ok so how are the +4 radio buttons identified? For example, what are the names of the radio button groups that are involved?  What are the export values of the specific buttons?

 

You might find your answer here:

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Beginner ,
Feb 02, 2023 Feb 02, 2023

Copy link to clipboard

Copied

Question groups are descriptive two-word phrases, describing the category and the specific criterion ithin that category (Thesis Concision, Thesis Position, etc). Individual buttons within each group are named by their point values and have apporpriate export values (4, 3, 1). I've managed to use them calculate the student's total score on sheet, so they're all functioning normally.

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
Community Beginner ,
Feb 02, 2023 Feb 02, 2023

Copy link to clipboard

Copied

More specifics with an example:

Name: Intro Context

Button Style: Circle

Radio Button Choice: +4

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
Community Expert ,
Feb 02, 2023 Feb 02, 2023

Copy link to clipboard

Copied

When writing code, it is required to used exact values. So, so write the script you want, we have to know the exact names of the radio button groups and the exact export values. In one post you say the exports are (4,3,1) and in the next you say the export is "+4".  The export is a string value, not a number. So we have to know the exact text used.  For your calculations, the exports are converted to a number, but for checking a button, the string value is needed. 

 

For this example I'll assume that "+4" is the export value. 

 

Button Script:

 

this.getField("Intro Context").value = "+4";
this.getField("Thesis Concision").value = "+4";
this.getField("Thesis Position").value = "+4";
.. Repeat for other radio button fields...

 

 

That's it. It's pretty simple. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Beginner ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

Thank you! That worked a treat! I have no experience with JavaScript (BASIC, on the other hand...) so I appreciate the example. I copied it over into WordPad (a few times over), swapped in my button names, and it worked like a charm!

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
Community Expert ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

LATEST

Excellent, but be careful when copying code. Code is written in plain ASCII text. When it is copied to an editor that is intended for word processing, some characters may be automatically converted to non-ASCII values. This conversion may cause errors.    It is best to use a plain text editor, or a editing application that is designed for handling code. 

  

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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