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

Radio Button to trigger a text field

Community Beginner ,
Jan 31, 2023 Jan 31, 2023

Hello all,

 

I am having trouble with the following code. I entered it in the Document JavaScripts. The goal is when radio button "5k" is selected the text box (TotalLDD) fills with 5000. When radio button "100" is selected the text box (TotalLDD) is filled with "Enter Amount" and the user can enter an amount. Please help! So close to finishing this form!

 

var selectedValue = this.getField("LDD").value;

 

if (selectedValue === "5k") {
this.getField("TotalLDD").value = "5000";
} else if (selectedValue === "100") {
this.getField("TotalLDD").value = "Enter Amount";
}

 

Any insight is much appreciated.

 

TOPICS
JavaScript
932
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Jan 31, 2023 Jan 31, 2023

Why did you place it there? Move it to the Mouse Up event of the radio-button fields, and change the first line to:

var selectedValue = event.target.value;

View solution in original post

Translate
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 ,
Jan 31, 2023 Jan 31, 2023

Why did you place it there? Move it to the Mouse Up event of the radio-button fields, and change the first line to:

var selectedValue = event.target.value;

Translate
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 ,
Feb 01, 2023 Feb 01, 2023
LATEST

Thank you try67. Made my day!

Translate
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