Help with dropdownlist validation using javascript

S

scott

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
 
S

SirCodesALot

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,142
Messages
2,570,819
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top