Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Faster way to check dropdown group.

Reply
Thread Tools

Faster way to check dropdown group.

 
 
MN
Guest
Posts: n/a
 
      12-23-2004
Hello all -

I have done ASP for a while but never found a quick way to handle this issue.

I have 8 dropdown boxes. Is there an easy to check that only 1 has selected
'Yes' and the others are 'No' without checking infinite combinations?

I usually do this with alot of coding for the combinations.

Any thoughts are appreciated.
MN
 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      12-23-2004
Are you talking about on generation of the dropdowns or when the form is
submitted? I'll assume you mean when the form is submitted.

Is the user only supposed to set 1 as yes, and all the other should then be
no? If so, how about using radio buttons instead...

What are you currently doing if a user submits the form with more than one
dropdown set to yes?

Ray at work

"MN" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello all -
>
> I have done ASP for a while but never found a quick way to handle this

issue.
>
> I have 8 dropdown boxes. Is there an easy to check that only 1 has

selected
> 'Yes' and the others are 'No' without checking infinite combinations?
>
> I usually do this with alot of coding for the combinations.
>
> Any thoughts are appreciated.
> MN



 
Reply With Quote
 
 
 
 
MN
Guest
Posts: n/a
 
      12-23-2004
Hi Ray,

Thanks for your response. Yes - I was referring to the latter when the form
is submitted. If more than one is selected as yes, I redirect my error
handler back to the user to indicate that only 1 can be selected as yes.
Might be more cumbersome than it's worth and switching to the option button
would be more beneficial.....yes?

Much thanks,
MN

"Ray Costanzo [MVP]" wrote:

> Are you talking about on generation of the dropdowns or when the form is
> submitted? I'll assume you mean when the form is submitted.
>
> Is the user only supposed to set 1 as yes, and all the other should then be
> no? If so, how about using radio buttons instead...
>
> What are you currently doing if a user submits the form with more than one
> dropdown set to yes?
>
> Ray at work
>
> "MN" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hello all -
> >
> > I have done ASP for a while but never found a quick way to handle this

> issue.
> >
> > I have 8 dropdown boxes. Is there an easy to check that only 1 has

> selected
> > 'Yes' and the others are 'No' without checking infinite combinations?
> >
> > I usually do this with alot of coding for the combinations.
> >
> > Any thoughts are appreciated.
> > MN

>
>
>

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      12-23-2004
MN wrote:
> Hello all -
>
> I have done ASP for a while but never found a quick way to handle
> this issue.
>
> I have 8 dropdown boxes. Is there an easy to check that only 1 has
> selected 'Yes' and the others are 'No' without checking infinite
> combinations?
>
> I usually do this with alot of coding for the combinations.
>
> Any thoughts are appreciated.
> MN


Dropdowns with only two choices? Why not radio buttons?

Assuming you've given them names to make them easily distinguishable from
the rest of the data elements in your form (say: dd1,...dd, you can simply
loop through them. Something like this:

function OnlyOneYes()
dim i,curval, newval, bResult
curval="No"
bResult=true
for i=1 to 8
newval=request.form("dd" & i)
if newval = "Yes" then
if curVal = "Yes" then
bResult=false
exit for
else
curVal = newVal
end if
next
if curval = "Yes" then
OnlyOneYes=bResult
else
OnlyOneYes=false
end if
end function

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      12-23-2004
Yes, I'd definitely go with the radio buttons.

Ray at work

"MN" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Hi Ray,
>
> Thanks for your response. Yes - I was referring to the latter when the

form
> is submitted. If more than one is selected as yes, I redirect my error
> handler back to the user to indicate that only 1 can be selected as yes.
> Might be more cumbersome than it's worth and switching to the option

button
> would be more beneficial.....yes?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
ajax cascading dropdown: second dropdown disabled acadam ASP .Net 0 12-27-2006 10:59 AM
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM
Select dropdown box bleeds into Javascript dropdown menu Mike HTML 1 12-18-2003 09:49 PM
Edit Mode - How do I populate dropdown in edittemplate from dropdown in another column? Steve Myers ASP .Net Datagrid Control 2 11-20-2003 01:09 PM



Advertisments