Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Radio buttons to display different predetermined text in a text box

Avatar

Level 2

Some help please.

I have a form with various numbers of radio button in. some grouped in two options and others with 4 options.

What I would like to happen is that depending on which radio button is selected a predetermined answer is then displayed in the accompanying text box. IE radio button true would insert "true" text in to the text field and again "false" if the false radio button is selected.

The principal would be the same for the 4 option radio buttons in my form.

Any help in this regard will be appreciated.

Raffe.

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi Raffe,

You can set the value of the RadioButtons as you want. Lets say you have set the values as 1,2,3,4.

Then in the click/change event of the radio buttons you can write the following script.

if (this.rawValue == 1)

     {

          TextField1.rawValue = "Anything you want";

     }

else

     {

           TextField1.rawValue = "Anything you want";

     }

For many options you can also use switch case statement.

Thanks,

Bibhu.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 9

Hi Raffe,

You can set the value of the RadioButtons as you want. Lets say you have set the values as 1,2,3,4.

Then in the click/change event of the radio buttons you can write the following script.

if (this.rawValue == 1)

     {

          TextField1.rawValue = "Anything you want";

     }

else

     {

           TextField1.rawValue = "Anything you want";

     }

For many options you can also use switch case statement.

Thanks,

Bibhu.

Avatar

Level 2

Thanks Bibhu.

This is just what I was looking for.

Much appreciated.