473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Faster way to check dropdown group.

MN
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
Jul 22 '05 #1
4 1250
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:6A**********************************@microsof t.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

Jul 22 '05 #2
MN
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" <MN@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.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


Jul 22 '05 #3
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.
Jul 22 '05 #4
Yes, I'd definitely go with the radio buttons.

Ray at work

"MN" <MN@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.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?

Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: melih.onvural | last post by:
Group, I'm having a tough time understanding some of the previous posts on this topic so I wanted to write what I've tried and hope that you can help me troubleshoot. I have a dropdown populated...
10
by: Extremest | last post by:
I know there are ways to make this a lot faster. Any newsreader does this in seconds. I don't know how they do it and I am very new to c#. If anyone knows a faster way please let me know. All...
5
by: =?Utf-8?B?QnJlbmRlbiBCaXhsZXI=?= | last post by:
Hello. I am reading a value from a table and trying to determine if that value exists in a list of values associated with a dropdownlist. If so, I select the value, otherwise, I don't. I haven't...
13
by: Shutey | last post by:
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on a fast XP pro PC, I have a form which requires 5 dropdowns populated with indentical values. I extract the values using SQL...
3
by: omarbhatti23 | last post by:
I have two dropdowns on my MS Access form. I want to make the second drop down dependant on what is selected in the first dropdown. How can i go about setting this up? For instance, ...
2
by: wildman | last post by:
RE: Gridview textbox has data check without postback.. javascript? I have a gridview with a textbox. I can set the textbox to autopostback and check for a value in a prerender event to decide if...
11
by: tokcy | last post by:
Hi everyone, I am new in php and ajax, i am facing the prob while i click on element of first drop down then in second dropdown all element showl come from database. I mean i have three dropdown 1....
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
11
by: Patrick | last post by:
Trying this question again in a different way and expanding it to another newsgroup. Looking for how I would do this. For an html form; Say I have three check boxes A, B, and C . When I click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.