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

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

469

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

Community Expert , 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;
}

Votes

Translate

Translate
Community Expert , 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;

Votes

Translate

Translate
Community Expert ,
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

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 ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

I tried this script but its not working!!!

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 ,
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

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 ,
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;

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 ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

It works thanks!!!

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