Page 1 of 1
Posted: Thu Jun 05, 2003 12:29 am
I have a big problem i think:)
i get my data from DB with php and then
I display them in DropDown box...
So now i wanted to check with JS if the name
already exists in that dropdown, when i click
the button, if the name already exists then
some error message displays, else go to next
so how to do that?
Posted: Fri Jun 06, 2003 4:51 am
it would be helpful to post some code.
Posted: Fri Jun 06, 2003 5:07 am
how do i get data from DB with PHP?
if u meant JS code i don't have any, cause i don't know how to write that.
and so on...
this is all in one form...
is this more clear?
Posted: Fri Jun 06, 2003 5:54 am
the values of the option are stored in
so you can do a loop through them to see if they exist.
here's a function that should work for you I haven't tested it but it might help you out a little.
boxname is your select box and textname is your edit box
for(i=0; i<boxname.options.length; i++)
if(boxname.options[i].value == textname.value)
alert("Value is already in list");