|
Compare Dropdown and textbox validation
Hi,
I need my users to choose a value from the dropdown and type the same value on the textbox. This is the code that I am using and getting an error even if I type the same value. HELP please.
<form action="insert_add_prod.asp" method="post" name="add_prod" id="add_prod" OnSubmit="return ValidateFields(this)">
<select name="prod_id" id="prod_id" >
<%
'Execute your Query using MyConnection
Do Until Myrs.eof
%>
<option value="<% = Myrs.Fields("item_id") %> ">
<% = Myrs.Fields("item_id") %>
</option>
<%
'Move to the next record
Myrs.movenext
loop
%>
</select>
Is that a problem? This is the code I am using to validate;
else if(document.add_prod.prod_id.options[document.add_prod.prod_id.selectedIndex].value != document.add_prod.prod_id_chk.value )
{
alert("Please enter same Product ID.");
document.add_prod.prod_id_chk.focus();
return false;
}
|