...

View Full Version : Compare Dropdown and textbox validation



ashok_19
10-18-2003, 02:00 AM
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;

}

Roelf
10-18-2003, 07:32 AM
Originally posted by ashok_19
<option value="<% = Myrs.Fields("item_id") %> ">

your values end with a space this way, is that what you are overseeing?
probably it should be
<option value="<% = Myrs.Fields("item_id") %>">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum