Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Wierd Radio Button Problem

Avatar

23-07-2008

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

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

23-07-2008

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

23-07-2008

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