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!!
Have something to add?