...

View Full Version : Client side validation DB Value < input



Skip
12-29-2003, 07:27 PM
Hello,

I have an asp Array I outpput the values of my array with a for each loop

I am try to validate a form field called quantity but i keep getting syntax errors. since this is in a loop i use addToCart<%=Choose%> as the form name so it writes a function for every form that is written with my asp

### Code looks somthing like this ###

For choose = 0 to Ubound(Products, 2)
%>
<SCRIPT LANGUAGE=JAVASCRIPT>
function validateMyForm(){
if(document.forms[0].addToCart<%=Choose%>.quantity.value=>"<%=Products(COL_QTY,Choose)%>"){
alert("Quantity Exceeds Stock ");
return false;
}else{
return true;
}
}
</SCRIPT>
<%
Response.write("<form Name=addToCart"&Choose&" method=post action=blah.asp onSubmit=ValidateMyForm()><input type=text name=quantity value="&Products(COL_QTY,Choose)&"><input type=submit name=Submit></form>")
Next
%>

Skip
12-30-2003, 11:52 AM
Can anyone see what is wrong with this ???? this is the output f vew source

##########################################

<SCRIPT LANGUAGE=JAVASCRIPT>
<!--
function validateMyForm8(){
if(document.forms[0].addToCart.quantity.value=>"1"){
alert("Quantity Exceeds Stock ");
return false;
}else{
return true;
}
}
-->
</SCRIPT>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum