Dynamic formvalidation.
Hello.
Im building an asp page and I have a major problem.
On the first page the users can enter how many textboxes he would like to have displayed and then he clicks on submit.
on the next page the prefered number of text boxes are displayed thru this code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
dim new_lines
%>
<script language="JavaScript">
<!-- Dölj
function formcontroll() {
<% new_lines = 0
do while csng(request.form("lines")) > new_lines
%>
if (document.form.<%=new_lines%>*name.value == "")
{
alert("Please enter a name.")
return false
}
<%
new_lines = new_lines + 1
Loop
%>
}
// -->
</SCRIPT>
<Form Action="page2.asp" name="form" Method="POST" onsubmit="return formcontroll()">
<%
'dim new_lines
new_lines = 0
do while csng(request.form("lines")) > new_lines
%>
<input type="type" name="<%=new_lines%>*name" value="">
<%
new_lines = new_lines + 1
Loop%>
<input type="Submit" name="submit" value="OK">
</body>
</html>
I want the javascript to check that the fields which are generated by we asp script are filled in by the user.
I would be very happy for some help.
Best regards
|