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

Toggle a Radio button when a Text Field value is met

Community Beginner ,
Apr 09, 2022 Apr 09, 2022

Copy link to clipboard

Copied

I am not a programmer and trying to learn how to work with PDF forms, thank you in advance for your time and concederation. The reason I am wanting to use Radio buttons over checkboxes is is preparation for scanning the form to poplate a database at a later date,

 

I am looking to toggle a Radio button when a numeric value is met in a Text Field.

     IF "Text Field" == "1", (toggle "Radio Button" ON), ELSE (toggle "Radio Button" OFF

 

Thanks for reading, the more detail the better as I am learning.

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

551

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 Beginner , Apr 10, 2022 Apr 10, 2022

Still having trouble grasping this concept...

 

My text field is named ProNumPos1

My Radio button is named ProNumRow1Col1

Radio Button Choice named ProR1C1

 

Under the Validate Tab for ProNumPos1 the option for Run custom validation script reads.

     this.getField("Radio Button").value = event.value == "1" ? "ProR1C1" : "Off";

 

When I bring the form into a Firefox browser window and enter 1 into the field the Radio button does not toggle from empty to fill.

Votes

Translate

Translate
Community Expert ,
Apr 09, 2022 Apr 09, 2022

Copy link to clipboard

Copied

You can use this as 'Validation' script of "Text Field":

this.getField("Radio Button").value = event.value == "1" ? "Choice1" : "Off";

Where "Choice1" is radio button choice, so change it to whatever you have set as choice.

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 Beginner ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

Still having trouble grasping this concept...

 

My text field is named ProNumPos1

My Radio button is named ProNumRow1Col1

Radio Button Choice named ProR1C1

 

Under the Validate Tab for ProNumPos1 the option for Run custom validation script reads.

     this.getField("Radio Button").value = event.value == "1" ? "ProR1C1" : "Off";

 

When I bring the form into a Firefox browser window and enter 1 into the field the Radio button does not toggle from empty to fill.

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 ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

You didn't change radio button name, try this:

this.getField("ProNumRow1Col1").value = event.value == "1" ? "ProR1C1" : "Off";

Depending on browser and application you open it with it may not work.

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 Beginner ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

LATEST

Thant did the trick, thank you so very much!!!

 

I have no programming expericen so again appreciate you pointing that out.

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