Skip to main content
Participant
March 27, 2020
Question

Radio button with range

  • March 27, 2020
  • 1 reply
  • 246 views

Hello,

 

Thank you for any help in advnce. I would like to imput a number in a text box and then have a radio button check atomaticly. 

2=<601

1= 500-600

0 = >499

 

For example Someone would put 550 in the text box and then that would atomaticly triger the 1 radio button. 

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
March 28, 2020

first off, your ranges are backwards. Two separate conditions can't be < (less than) 600  and between 500 and 600.

I'll assum you got the exactly backwards.

Set a radio button (or checkbox) by setting the radio button field value to the export value. So I'm assuming your export values are 0,1,2

 

Add this code to the custom validation script for the text field.

 

if(event.value < 500)

    this.getField("radiobutton").value = 0;

else if((event.value >= 500) && (event.value <= 600))

    this.getField("radiobutton").value = 1;

else

    this.getField("radiobutton").value = 2;

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often