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

assigning default value to radio button that further could be changed

Community Beginner ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

Hi there,

I'm having a dropdown (CN) where client chose one of the options from A to G. Depending on this choice, some of my fields are brought from readonly true, to readonly false (this is done by doc level function EnableFrom... and DisableForm...) .

So for example when B, C and G are chosen in dropdown, radio button ( field P6RB01) can be filled.

Now I want to set a default value of this radio button to "No", when "G" is selected. Here comes the script  placed on  a hidden field in "Calculate" tab that triggers radio button:

// target amount status toggle

var CN = getField("CN1")

if ((CN.value == "B") ||

(CN.value == "C") ||

(CN.value == "G")) {

EnableFormFieldFromGray("P6RB01")

}else{

DisableFormFieldToGray("P6RB01")

this.getField("P6RB01").value = "Off";

}

//set value of RB to "no" if G chosen

if(CN.value == "G") {

    this.getField("P6RB01").value = "No";

}

Value is set to "No", but the idea is that the user can change this default value afterwards. Now this script is still reverting to "No", even if "Yes" is chosen later. Unfortunately defaultValue property doesn't work - apparently it works only when the form is reset.

I tried also placing it on dropdown field itself,  but it is not reliable, as triggers really doesn't work good...

Any ideas?

Thanks!!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

79

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
no replies

Have something to add?

Join the conversation