Skip to main content
Inspiring
May 23, 2025
Answered

Radio Buttons Based on Text Field Value

  • May 23, 2025
  • 1 reply
  • 492 views

Below is validation script in the field where the value changes and I have radio buttons with two choices.  When it is greater or equal to 1000, Choice 1 (which is yes).  However, it is not changing to Choice 2 (which is no) when below 1000.

if (event.value >= 1000)
{
   this.getField("CheckBox").valueAsString == "Choice1"
} else {
   this.getField("CheckBox").valueAsString == "Choice2"
}

 

Correct answer PDF Automation Station

Your == should be single = signs and valueAsString should be value:

if (event.value >= 1000)
{
this.getField("CheckBox").value = "Choice1"
} else {
this.getField("CheckBox").value = "Choice2"
}

1 reply

PDF Automation Station
Community Expert
Community Expert
May 23, 2025

Your == should be single = signs and valueAsString should be value:

if (event.value >= 1000)
{
this.getField("CheckBox").value = "Choice1"
} else {
this.getField("CheckBox").value = "Choice2"
}

MBChelsAuthor
Inspiring
May 24, 2025

What is the difference between == and =?

PDF Automation Station
Community Expert
Community Expert
May 24, 2025

== means is equal to.  It compares 2 values and returns true or false.  2==2 returns true.  = means equals.  In your script you want to change the value to Choice1 or Choice2 so you want the field value to equal them.