Page 1 of 1

SOLVED - How to get the value from a radio button

Posted: Thu Jul 28, 2011 4:11 pm
by admin12
I've had it with the combo box for now, so for the gender, I am forced to use something else, like the radio buttons. I have two radio buttons, one for Male and one for Female and then grouped them. I set their RadioBehavior to true so only one or the other can be chosen.

The individual controls are called chcMale and chcFemale.

How do I extract the value from the one chosen? I tried true, false 0's and 1's - none of that worked.

So,

if chcMale = "1" then
put "Male" into Gender
end if

if chcFemale = "1" then
put "Female" into Gender
end if

did not work. Nor did true or false.

So, how do I extract the answer chosen?

Mike

Re: How to get the value from a radio button

Posted: Thu Jul 28, 2011 4:23 pm
by Klaus
Hi Mike,

Code: Select all

...
if the hilite of btn "chcMale" then
  put "Male" into gender
else

   ## There are only two options, so we do not need to check the other option!
  put "Female" into gender
end if
...
Hint:
You can omit the "= true" part, in that case the engine presumes you are querying TRUE.
FALSE needs to be scripted however: if the hilite of btn X = FALSE then

All this and more can be found in the stack "Controls" here:
http://www.runrev.com/developers/lesson ... nferences/
In case I didn't mention and you didn't check this yet!


Best

Klaus

Re: How to get the value from a radio button

Posted: Thu Jul 28, 2011 4:50 pm
by admin12
Very nice. I just read through your controls chat/lesson. Good stuff and it will help.

Still, I will ask for help and I thank you for yours.

I will go through all of those lessons when I have the time.

Mike

Re: How to get the value from a radio button

Posted: Fri Jul 29, 2011 3:13 am
by admin12
Does this also work for check boxes? Are they identical to radio buttons?

Mike

Re: How to get the value from a radio button

Posted: Fri Jul 29, 2011 11:33 am
by Klaus
Yep.