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

radio button and values

Explorer ,
Aug 19, 2020 Aug 19, 2020

Copy link to clipboard

Copied

I have a group of 2 radio buttons in two lines, related to the first the values a, b, (a*b)

the second line a1, b1, (a1*b1). in a pdf form

 

I would like to have a script that gives the following:

if RB1 is checked the values a, b, a*b will appear, if RB2 is checked RB1 line will show no values and values in RB2 will appear and vice versa...

 

RB1       a              b                 a*b

RB2       a             b1              a1*b1

 

Thanks

TOPICS
Acrobat SDK and JavaScript

Views

481

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 , Aug 20, 2020 Aug 20, 2020

I'm assuming that the pair of RadioButtons aremutually exclusive( both fields assigned the same fieldname but a different export value).

 

In the example below, I named the radio buttons fields as "RB", then assign export values of "RB1" and "RB2" respectively.

 

The caluclating fileds are named with the same labels that you used in your inquiry to make it easier to visualize.

 

You can use the  following script as a custom calculation script in the  the (a*b) total field, for example:

 

event.value = t
...

Votes

Translate

Translate
Community Expert ,
Aug 19, 2020 Aug 19, 2020

Copy link to clipboard

Copied

Are you asking about hiding the fields ?

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
Explorer ,
Aug 20, 2020 Aug 20, 2020

Copy link to clipboard

Copied

Yes, please.

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 ,
Aug 20, 2020 Aug 20, 2020

Copy link to clipboard

Copied

I'm assuming that the pair of RadioButtons aremutually exclusive( both fields assigned the same fieldname but a different export value).

 

In the example below, I named the radio buttons fields as "RB", then assign export values of "RB1" and "RB2" respectively.

 

The caluclating fileds are named with the same labels that you used in your inquiry to make it easier to visualize.

 

You can use the  following script as a custom calculation script in the  the (a*b) total field, for example:

 

event.value = this.getField("a").value *  this.getField("b").value; 


var f = this.getField("RB");

if (f.value == "RB1") {
this.getField("a").display = display.visible;
this.getField("b").display = display.visible;
event.target.display = display.visible;
} else {
this.getField("a").display = display.hidden;
this.getField("b").display = display.hidden;
event.target.display = display.hidden;
 } 

 if (f.value == "RB2") {
this.getField("a1").display = display.visible;
this.getField("b1").display = display.visible;
this.getField("ab1").display = display.visible;

} else {

this.getField("a1").display = display.hidden;
this.getField("b1").display = display.hidden;
this.getField("ab1").display = display.hidden;

}

 

 

 

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
Explorer ,
Aug 20, 2020 Aug 20, 2020

Copy link to clipboard

Copied

LATEST

Thanks a lot, it works perfectly!

I do appreciate your help.

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