Javascript help

Community Beginner ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

3 Radio button but same group

choice1

choice2

choice3

 

Field name: Box6

Box6 = 150 when choice1 is selected

Box6 = 220 when choice2 is selected

Box6 = 270 when choice3 is selected

I need the script for box6 please

TOPICS
JavaScript

Views

180

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
community guidelines

correct answers 2 Correct Answers

Adobe Community Professional , Apr 29, 2021 Apr 29, 2021
Let's say that the name of the radio button field is "Radio1" Put this in the Custom Calculation script for the text field. var cRadioValue = this.getField("Radio1").value; switch(cRadioValue) { case "choice1": event.value = 150; break; case "choice2" event.value = 220; break; case "choice3": event.value = 270; break; default": event.value = 0; break; }

Likes

Translate

Translate
Adobe Community Professional , Apr 29, 2021 Apr 29, 2021
You can also change radio buttons choices to values you need. For example: instead of choice1 add 150, instead of choice2 add 220...etc. Then as calculation script of box6 field use this: event.value = ""; if(this.getField("Group1").value != "Off") event.value = this.getField("Group1").value;

Likes

Translate

Translate
Adobe Community Professional ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

 

Let's say that the name of the radio button field is "Radio1"

Put this in the Custom Calculation script for the text field.

 

var cRadioValue = this.getField("Radio1").value;
switch(cRadioValue)
{
   case "choice1":
      event.value = 150;
      break;
   case "choice2"
      event.value = 220;
      break;
   case "choice3":
      event.value = 270;
      break;
   default":
      event.value = 0;
      break;
}
Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
community guidelines
Community Beginner ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

I tried this script but its not working!!!

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
community guidelines
Adobe Community Professional ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

LATEST

Did you change the radio button field name "Radio1" to the real name of your radio button group?

Do the export values match the values used in the script?

 

 

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

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
community guidelines
Adobe Community Professional ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

You can also change radio buttons choices to values you need. For example: instead of choice1 add 150, instead of choice2 add 220...etc. Then as calculation script of box6 field use this:

event.value = "";
if(this.getField("Group1").value != "Off")
event.value = this.getField("Group1").value;

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
community guidelines
Community Beginner ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

It works thanks!!!

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
community guidelines