Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2004, 10:31 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old June 18th, 2004, 02:37 PM
Registered User
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry I don't have a lot of time but if search the internet for "onSubmit" this is where you would trap the page allow javascript to validate that all fields would be filled in and you can stop the submission of the page back to the server. A lot of information is out there.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Columns & Dynamic Grouping ??? nileshgambhava BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 1 March 24th, 2008 07:58 AM
help writing dynamic form data to dynamic table ublend SQL Server ASP 1 June 1st, 2007 08:09 AM
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
Dynamic Columns & Dynamic Grouping ??? nileshgambhava SQL Server 2005 0 December 12th, 2006 12:45 AM
Dynamic Checkboxes using dynamic Select Values bsheridan Classic ASP Databases 0 March 12th, 2006 10:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.