Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 18th, 2004, 10:31 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old June 18th, 2004, 02:37 PM
Registered User
 
Join Date: Jun 2004
Location: , , .
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:50 AM.


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