Expand my Community achievements bar.

Wierd Radio Button Problem

Avatar

Former Community Member
can we set the value of a radio button at runtime?



Suppose there are two radio buttons: Yes and No.



Suppose a user chooses Option1 from a drop down list, then Radio button Yes should be highlighted, if the user chooses Option 2 from the drop down list, then the Radio button No should be highlighted.



I am trying the following code but its not working:



if (option.rawValue == Option1)

{

radioButton1.rawValue = true;

}

else

{

radioButton2.rawValue = true;



}



Is it the rawValue property of radio button that I should use or something else?



I am really stuck on this. Any help would be highly appreciated
3 Replies

Avatar

Former Community Member
Yes you should be using the rawValue .....I always set the RadioButtonList instead of the individual radio buttons. Also do an app.alert(RadioButtonList.rawValue) to ensure you are testing the right value.

Avatar

Former Community Member
It's called RadioButtonList a "group" of radio options.

In your example, in one RadioButtonList, you have 2 options: Yes and No. You should specify a value for each option in the RadioButtonList's Binding tab.

By doing this you're able to change the value at run time:



form1.subform.RadioButtonList.rawValue = "1"; // for Yes option.



an so on.



I hope this helpful.



Diego