Faster way to check dropdown group.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > IIS server support > IIS ASP > Faster way to check dropdown group.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Faster way to check dropdown group.  
MN


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-23-04 10:59 PM

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





[ Post a follow-up to this message ]



    Re: Faster way to check dropdown group.  
Ray Costanzo [MVP]


Report This Message To A Moderator Edit/Delete Message


 
12-23-04 10:59 PM

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" <MN@discussions.microsoft.com> wrote in message
news:6A73D2D9-1DE6-476D-B8F2-4378FA3FE8D2@microsoft.com...
> 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







[ Post a follow-up to this message ]



    Re: Faster way to check dropdown group.  
MN


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-23-04 10:59 PM

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 b
e
> 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" <MN@discussions.microsoft.com> wrote in message
> news:6A73D2D9-1DE6-476D-B8F2-4378FA3FE8D2@microsoft.com... 
> issue. 
> selected 
>
>
>





[ Post a follow-up to this message ]



    Re: Faster way to check dropdown group.  
Bob Barrows [MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-23-04 10:59 PM

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,...dd8), 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.







[ Post a follow-up to this message ]



    Re: Faster way to check dropdown group.  
Ray Costanzo [MVP]


Report This Message To A Moderator Edit/Delete Message


 
12-23-04 10:59 PM

Yes, I'd definitely go with the radio buttons.

Ray at work

"MN" <MN@discussions.microsoft.com> wrote in message
news:DA5E086F-EA39-4C62-92E6-442727898A13@microsoft.com...
> 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?
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:15 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register