473,396 Members | 2,147 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,396 software developers and data experts.

Help with dropdownlist validation using javascript

Hello,

Thanks in advance for any help you might be able to offer...

I have an html table with two columns and 10 rows. The first column
contains a textbox that is populated. The second column contains a
drop down box with selectable values from 1-9. This row is repeated
10 times with different text in each rows first column but with the
exact same drop downlist in all rows...to give you a table of 10
elements long and 2 elements wide.

This is where the fun begins...I want to limit the user to only be
able to select the number from the drop down box once. If the user
selected 1 in row 1 then that user cannot select 1 in any of the other
9 rows and so on...am I making myself clear?

I don't necessarily have to have the number disappear from the drop
down list once it is used but it would be nice that if the user has
already selected that value that I could give some kind of an error
messge to them....

I have no idea how to accomplish this...the application is written
using asp.net 2.0 and all objects are generated dynamically when the
page is displayed to the user. Due to application design I don't
believe I can handle a postback event.

I really appreciate any help with this matter.

Thanks,
Scott

Jun 27 '08 #1
1 2139
On Apr 28, 1:28*pm, scott <sdaniel1...@gmail.comwrote:
Hello,

Thanks in advance for any help you might be able to offer...

I have an html table with two columns and 10 rows. *The first column
contains a textbox that is populated. The second column contains a
drop down box with selectable values from 1-9. *This row is repeated
10 times with *different text in each rows first column but with the
exact same drop downlist in all rows...to give you a table of 10
elements long and 2 elements wide.

This is where the fun begins...I want to limit the user to only be
able to select the number from the drop down box once. *If the user
selected 1 in row 1 then that user cannot select 1 in any of the other
9 rows and so on...am I making myself clear?

I don't necessarily have to have the number disappear from the drop
down list once it is used but it would be nice that if the user has
already selected that value that I could give some kind of an error
messge to them....

I have no idea how to accomplish this...the application is written
using asp.net 2.0 and all objects are generated dynamically when the
page is displayed to the user. *Due to application design I don't
believe I can handle a postback event.

I really appreciate any help with this matter.

Thanks,
Scott
Hi Scott,

Why cant you handle a post back event? So you are saying you cannot
add an onselectedindexchange event to the drop down lists? Seems like
that since the page is creatd dynamically, then in the code behind
would be a good place to filter the drop downs based on what has
already been selected.

You could add javascript to achieve the same. You would need to give
each drop down a unique ID in the codehind then, add an onchange event
to the drop downs to go look at what has been used and perform results
accordingly.

hope this helps.
Jun 27 '08 #2

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

Similar topics

1
by: ritskits | last post by:
I have the dropdownlist that is populated when the form is loaded. I have the button that opens search child window using the modalwindowdialog and it returns the value that I want to add to the...
7
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
2
by: Wes Weems | last post by:
I'd like to have a 3 values in a drop down, and have a validator not allow a form submit unless its 2 of the 3 values (eg, one of the values says "select one") I used custom validator and did a...
1
by: Reddy | last post by:
Hi, My web form has a dropdown list and a textbox server controls. The user must enter some text in the textbox he selects only the last item in the dropdownlist. I tried using a custom...
9
by: Alan Silver | last post by:
Hello, I have some simple client-side Javascript validation that was working fine until now. For some reason (don't ask me), it has stopped working and I can't figure out why. I have switched to...
0
by: Aws | last post by:
My crazy GridView !! I am using Visual Studio 2005, I have a problem with my GridView. I have one access .mdb table and when I update a record on the table EVERYTHING is perfect. I made a Web...
0
by: eurorscg | last post by:
Hi, i have this dropdownlist that breaks xhtml w3c validation.because it generates a select tag with a javascript property. this only happens when autopostback is set to true. so the the...
3
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls the...
2
by: nomad | last post by:
Hi, I have a databound dropdownlist. I have added AppendDataBoundItems="True" so that I am able to enter a item in the dorpdownlist of "-- Please select --". I would like to be able to set it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.