Avatar of Tpaul_10
Tpaul_10
Flag for United States of America asked on

Multiple Radio Button values

Experts,

I have 6 radio button options or choices for the user with some other options (text box, dropdown etc) in my CF page and user can check or choose more than one radio button option. So, I would like to get the radio button option  value as comma delimited list in my action file, (like 1,2 OR 1,2,5,3 or 1,2,3,4,5,6 or may be just 1). How can I achive this? Please help me out.

<input type="radio" name="opt1" size="30"  value="1" onDblClick="uncheckOpenRadio();">Option 1
<input type="radio" name="opt2" size="30"  value="2" onDblClick="uncheckAssignRadio();">Option 2      
<input type="radio" name="opt3" size="30"  value="3" onDblClick="uncheckDeclineRadio();">Option 3<br>
<input type="radio" name="opt4" size="30"  value="4" onDblClick="uncheckPrdRadio();">Option 4
<input type="radio" name="opt5" size="30"  value="5" onDblClick="uncheckModeledRadio();">Option 5
<input type="radio" name="opt6" size="30"  value="6" onDblClick="uncheckQuoteRadio();">Option 6

Thanks in advance
ColdFusion Language

Avatar of undefined
Last Comment
SidFishes

8/22/2022 - Mon
_agx_

choose more than one radio button option.
Then I'm not sure why you're using radio buttons. radio buttons are designed to allow only one option to be checked. It probably works for you because you're using different "names" ie opt1, opt2, ... but that's confusing. It's not how radio buttons are designed to work.

I'd use checkboxes instead. Just give them all the same name. Then whatever values are checked will be passed as a csv list

<input type="checkbox" name="opt" ... >Option 1
<input type="checkbox" name="opt" ... >Option 2
<input type="checkbox" name="opt" ... >Option 4
....
Tpaul_10

ASKER
I agree with you Agx, but the users wanted radio buttons since they have check boxes for a different option in the page.

That is the reason I have onDblClick="uncheckOpenRadio();" fucntion in my HITML.
Appreciate if you can tell me how can I get these values in a comma separated values.

Thanks for your suggestion

ASKER CERTIFIED SOLUTION
SidFishes

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
gdemaria

> but the users wanted radio buttons since they have check boxes for a different option in the page

that's kind of funny...   it's like insisting that your mechanic put gasoline in with your windshield washer solution.

There are some things that users should not have a say over.

You could also try these alternatives.  

Perhaps style your checkboxes so they look different...
http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/

Or you can use an image instead of a checkbox, the image could look like a radio button or an empty/full glass or a horse with/without a rider :) ....  but behind it is a checkbox...

http://homepage.ntlworld.com/vwphillips/ImageCheckBox/ImageCheckBox.htm
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
_agx_

There are some things that users should not have a say over

Amen. I was thinking the same thing .. but decided to let someone else fight the crazy user / bizzare corp culture battles today. lol
gdemaria


Lol, we could have an entire thread about crazy user requests...  I remember a client demanding never to have to save their web application.  "I don't want to ever click a "Save" button, I want things to be saved for me automatically..."    This was before ajax come into the main stream...

_agx_

<ot>
Are you kidding? We could have an entire site devoted to "creative" user requests ;)

I don't want to ever click a "Save" button
Haha. Oh man ... I'm having crazy client flashbacks ... ;)
</ot>
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SidFishes

almost all of my work is done for internal projects so the only crazy requests are the ones i give myself. Planning meetings are a bit like the part in LOTR where Smeagol & Gollum are arguing with each other. :)

gd's styling idea is what I'd go with to give a different visual look without resorting to the silliness of the JS i provided ;)