| Author |
Topic Search Topic Options
|
pedalcars
Senior Member
Joined: 12 August 2002
Location: United Kingdom
Status: Offline
Points: 268
|
Post Options
Thanks(0)
Quote Reply
Topic: Problem: Multiple multiple radio buttons 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!
|
|
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
ljamal
Mod Builder Group
Joined: 16 April 2003
Status: Offline
Points: 888
|
Post Options
Thanks(0)
Quote Reply
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.
Edited by ljamal
|
|
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 29 October 2003 at 9:05am |
|
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
pedalcars
Senior Member
Joined: 12 August 2002
Location: United Kingdom
Status: Offline
Points: 268
|
Post Options
Thanks(0)
Quote Reply
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?
|
|
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 30 October 2003 at 8:05am |
even better!!
less code
you obviously would have to physically move the checkboxes
Edited by MorningZ
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
ljamal
Mod Builder Group
Joined: 16 April 2003
Status: Offline
Points: 888
|
Post Options
Thanks(0)
Quote Reply
Posted: 30 October 2003 at 8:38am |
MorningZ wrote:
even better!!
less code
you obviously would have to physically move the checkboxes |
Great! You've re-created the radio button.
|
|
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
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
|
 |