View Full Version : Compare Dropdown and textbox validation

10-18-2003, 02:00 AM
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") %>
'Move to the next record

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.");
return false;


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