Expand my Community achievements bar.

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

populate text field with caption of radio list

Avatar

Level 1

Hi, I have been looking for an answer to this all morning.  I need to use the value from a radio list to populate a text field.  I can get the selected numeric value OK using

$.rawValue = form1.#subform[0].Table3.Row1.#subform[0].Location[0].rawValue

but i want to get the text item associated with the value.  this could be the caption of the selected radio button, since it is the same thing.  I don't want to use an if statement becuase i have have a bunch of forms to create and that would mean changing things in a few times in each form.  How can I get the text value from the item column shown below?

screenshot.17.png

1 Accepted Solution

Avatar

Correct answer by
Level 10

Try the following with two changes to your heirarchy.

1) Currently you do not have a name for Page1. Make sure you assign a name for easy referencing. ("Page1").

2) Set a name for Subform that holds PeriodRadio. ("Subform1").

Thanks

Srini

View solution in original post

6 Replies

Avatar

Level 10

Try the following code to get the selected RadioButton's caption.

 

Thanks

Srini

Avatar

Level 1

this is what i have on the text field but i get a syntax error.  i'm afraid i am not great with javascript

form1.#subform[0].TextField4::calculate - (JavaScript, client)

$.rawValue = (form1.#subform[0].Table3.Row1.#subform[0].Location[0].selectedMember().caption.value.text.value);

Avatar

Level 10

Probably the path is not able to resolve to the RadioButton list.

Try

     Location.selectedMember().caption.value.text.value..

I see a space after "selectedMember" and the parenthesis after that. Try removing that space as well.

If you still have issues, try posting an image of your Heirarchy highlighting the RadioButton List in it.

Thanks

Srini

Avatar

Level 1

thanks srini, i dont have a space in the actual field, not sure why it showed in my post.  it also failed if i changed it to what you suggested.  here is my hierarchy, i think the problem must be the path i am putting in the script, can you see where i am going wrong?

screenshot.18.png

Avatar

Correct answer by
Level 10

Try the following with two changes to your heirarchy.

1) Currently you do not have a name for Page1. Make sure you assign a name for easy referencing. ("Page1").

2) Set a name for Subform that holds PeriodRadio. ("Subform1").

Thanks

Srini

Avatar

Level 1

great, now its working.  Thanks Srini