Skip to main content
Known Participant
December 3, 2022
Answered

Get the Field value from Radio buttons to display on a field/

  • December 3, 2022
  • 1 reply
  • 1506 views

I have two text fields Yes(Text1) and No(Text2). , two radio buttons YES and No. With a "Pass Button". So when I click on Pass the value from the "Text1" field should directly show in another text field named "Text4" and even when I change the value in "Text1" and "Text2" but do not click on "Pass" button I should get the previously entered value. I've attached the form.

This topic has been closed for replies.
Correct answer bebarth

So, here it si:

// Pass button
this.addScript("myVariables", "varText1=this.getField (\"text1\").value;\rvarText2=this.getField (\"text2\").value;");
if (this.getField ("Group1").value=="Yes") this.getField ("Text4").value=varText1;
else if (this.getField ("Group1").value=="No") this.getField ("Text4").value=varText2;
else this.getField ("Text4").value="";

// YES radio button
if (event.target.value=="Yes") this.getField ("Text4").value=varText1;

// NO radio button
if (event.target.value=="No") this.getField ("Text4").value=varText2;

@+

1 reply

bebarth
Community Expert
Community Expert
December 3, 2022

Hi,

Here is a script for your Pass button:

if (this.getField ("Group1").value=="Yes") this.getField ("Text4").value=this.getField ("text1").value;
else if (this.getField ("Group1").value=="No") this.getField ("Text4").value=this.getField ("text2").value;
else this.getField ("Text4").value="";

@+

Known Participant
December 3, 2022

It's working just needs one thing fixed. I want it like the attached video.

bebarth
Community Expert
bebarthCommunity ExpertCorrect answer
Community Expert
December 3, 2022

So, here it si:

// Pass button
this.addScript("myVariables", "varText1=this.getField (\"text1\").value;\rvarText2=this.getField (\"text2\").value;");
if (this.getField ("Group1").value=="Yes") this.getField ("Text4").value=varText1;
else if (this.getField ("Group1").value=="No") this.getField ("Text4").value=varText2;
else this.getField ("Text4").value="";

// YES radio button
if (event.target.value=="Yes") this.getField ("Text4").value=varText1;

// NO radio button
if (event.target.value=="No") this.getField ("Text4").value=varText2;

@+