hi list.. need help on validation
My asp code looks like this:
----------
<form method=post name="form" action="order_insert.asp" onSubmit="return validate(this)" >
----------
<%
iCount=10
for i=1 to iCount
iCount=iCount+1 %>
<tr bgcolor=#eeeeee>
<td><b><%=i%></b></td>
<td><input type=text name="item_code<%=i%>" size=15></td>
<td><input type=text name="stock_item<%=i%>" size=6></td>
<td><input type=text name="description<%=i%>" size=30></td>
<td><input type=text name="order_qty<%=i%>" size=5>
</tr>
<%
Next
%>
</table>
<center><br><input type=submit name="button" value="Submit">
<input type=reset value="Reset">
----------
The problem is i don't know how to do validation in javascript using for loop.. i've tried something like this :
------------
var x;
for (x=1; x<11; x++)
{
if(document.form.description+x.value == '')
{
alert ("description empty"
document.form.description+x.focus();
return false;
}
}
-------
1) It never prompt any alert message although the description field is empty/not empty.
2) If i use 'if(document.form.description+x.value != '')' then,it prompt alert box if the fields are empty/not empty
3) If i use 'document.form.description+x.focus();' ,it shows error message "Object doesn't support this property or method"
I'm really going crazy with this. Please help me..
thanks a lot,
rgds,
parames.s
My asp code looks like this:
----------
<form method=post name="form" action="order_insert.asp" onSubmit="return validate(this)" >
----------
<%
iCount=10
for i=1 to iCount
iCount=iCount+1 %>
<tr bgcolor=#eeeeee>
<td><b><%=i%></b></td>
<td><input type=text name="item_code<%=i%>" size=15></td>
<td><input type=text name="stock_item<%=i%>" size=6></td>
<td><input type=text name="description<%=i%>" size=30></td>
<td><input type=text name="order_qty<%=i%>" size=5>
</tr>
<%
Next
%>
</table>
<center><br><input type=submit name="button" value="Submit">
<input type=reset value="Reset">
----------
The problem is i don't know how to do validation in javascript using for loop.. i've tried something like this :
------------
var x;
for (x=1; x<11; x++)
{
if(document.form.description+x.value == '')
{
alert ("description empty"
document.form.description+x.focus();
return false;
}
}
-------
1) It never prompt any alert message although the description field is empty/not empty.
2) If i use 'if(document.form.description+x.value != '')' then,it prompt alert box if the fields are empty/not empty
3) If i use 'document.form.description+x.focus();' ,it shows error message "Object doesn't support this property or method"
I'm really going crazy with this. Please help me..
thanks a lot,
rgds,
parames.s