Print Page | Close Window

Problem: Multiple multiple radio buttons

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=6818
Printed Date: 31 March 2026 at 4:31pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Problem: Multiple multiple radio buttons
Posted By: pedalcars
Subject: Problem: Multiple multiple radio buttons
Date Posted: 29 October 2003 at 6:47am
I'm trying to do a form where each item in a list is displayed and given an "accept", "decline" or "ignore" option.

I can do this with check boxes, where the box names are (eg) ChkAccept, ChkDecline, ChkIgnore and have values set by the list item ID number; the processing file then does (in the case of acceptances):

For each laryAcceptID in Request.Form("ChkAccept")

'Then goes through DB where item ID = laryAcceptID;
'Ammend record as appropriate to note acceptance

Next

'Similar loop then processes the Declines, for Request.Form("ChkDecline")


However, that doesn't stop people ticking more than one box for each item, which obviously causes the system to throw a wobbly.

I'd like to therefore use radio buttons, but for each item I believe I'm right in thinking all three need the same name (in order to group correctly). This means I can't see a way of processing the information similar to the above.

Any suggestions gratefully received!



-------------
http://www.pedalcars.info/ - www.pedalcars.info

The most fun on four wheels




Replies:
Posted By: MorningZ
Date Posted: 29 October 2003 at 8:07am

so you have:

Accept:
- checkbox1
- checkbox2
- checkbox3

Decline:
- checkbox4
- checkbox5
- checkbox6

and you don't want someone to be able to select from both sets of boxes?

answer that and i'll whip up some Javascript to handle that.. radio boxes are NOT going to work in this case because you can only select one, and you said above that people can select multiple in a group, so that rules out radios...

man, let me tell you, between this thread and others by you in the past, you write some whacked/confusing pages for your clients/members



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: ljamal
Date Posted: 29 October 2003 at 8:20am
What you should do is:

Line 1 o Accept o Decline o Ignore
Line 2 o Accept o Decline o Ignore
Line 3 o Accept o Decline o Ignore
Line 4 o Accept o Decline o Ignore
Line 5 o Accept o Decline o Ignore

The radio button in each line should have the same name, but different values. So let's say you have
Line 1
<input name=1 value=1 type=radio>Accept
<input name=1 value=-1 type=radio>Decline
<input name=1 value=0 type=radio>Ignore

Line 2
<input name=2 value=1 type=radio>Accept
<input name=2 value=-1 type=radio>Decline
<input name=2 value=0 type=radio>Ignore

etc...
Then you can do:
For i =1 to Request.Form.Count
if IsNumeric(Request.Form.Key(i)) then
    if Request.Form(i)=1 then
        ... Accept ....
    elseif Request.Form(i)=-1 then
        ... Decline ....
    else
        ... Ignore ...
    end if
end if
Next


Note this assumes your input names are numeric. If not then remove the IsNumeric check. I would use numeric values simply because it makes it easier to ignore other posted variables.


-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: MorningZ
Date Posted: 29 October 2003 at 9:05am
http://www.morningz.com/test/checkboxGroups.html - here's what i was thinking

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: pedalcars
Date Posted: 30 October 2003 at 3:45am
Ljamal, thanks, I'll give it a go.

MorningZ, everything's for a purpose.

As it happens, this time you've got the wrong end of the stick. Maybe I wasn't clear enough:

I don't want anyone to check more than one box per item

So, you'd have:

| Item 1: O (accept) | O (decline) | O (ignore) |

If there was more than one item, there'd be more than one line. Then for each item you could select one box, so you could for example accept items 1, 3 and 5, decline items 2 and 6, and ignore item 4.

Does that make more sense?

-------------
http://www.pedalcars.info/ - www.pedalcars.info

The most fun on four wheels



Posted By: MorningZ
Date Posted: 30 October 2003 at 8:05am

even better!!

http://www.morningz.com/sections/playground/files/code/checkboxGroup2.html - less code

you obviously would have to physically move the checkboxes



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: ljamal
Date Posted: 30 October 2003 at 8:38am
Originally posted by MorningZ MorningZ wrote:

even better!!


http://www.morningz.com/sections/playground/files/code/checkboxGroup2.html - less code


you obviously would have to physically move the checkboxes



Great! You've re-created the radio button.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: MorningZ
Date Posted: 30 October 2003 at 8:40am

i personally despise/hate the radio button...

but hey, sorry you think i wasted my time.. i'll do all the practice with Javascript i can get.....



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: ljamal
Date Posted: 30 October 2003 at 8:47am
I didn't say it was a waste of time, but why bother recreating the functionality of something you don't like in the first place. Rather than using the checkbox or radio button, a select list could have been used. To reproduce the radio functionality in a checkbox using javascript just isn't very practical.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: MorningZ
Date Posted: 30 October 2003 at 8:58am

but practicing javascript and sharing the code is practical... is for me anyways..

sorry you don't agree nor find my replies usefull... maybe someone else does or will down the road



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: pedalcars
Date Posted: 03 November 2003 at 9:30am
MorningZ, I've found plenty of your posts more than helpful in the past.

On this occasion though, it's Ljamal I have to thank; I've used the method you suggested and it works fine, does exactly what I wanted.

Thanks.



-------------
http://www.pedalcars.info/ - www.pedalcars.info

The most fun on four wheels




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net