SOLVED - How to get the value from a radio button

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
admin12
Posts: 412
Joined: Wed May 11, 2011 9:47 am

SOLVED - How to get the value from a radio button

Post by admin12 » Thu Jul 28, 2011 4:11 pm

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
Last edited by admin12 on Fri Jul 29, 2011 3:24 pm, edited 1 time in total.

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to get the value from a radio button

Post by Klaus » Thu Jul 28, 2011 4:23 pm

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

admin12
Posts: 412
Joined: Wed May 11, 2011 9:47 am

Re: How to get the value from a radio button

Post by admin12 » Thu Jul 28, 2011 4:50 pm

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

admin12
Posts: 412
Joined: Wed May 11, 2011 9:47 am

Re: How to get the value from a radio button

Post by admin12 » Fri Jul 29, 2011 3:13 am

Does this also work for check boxes? Are they identical to radio buttons?

Mike

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to get the value from a radio button

Post by Klaus » Fri Jul 29, 2011 11:33 am

Yep.

Post Reply