Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-07-2003, 09:20 PM   PM User | #1
Speedy
Regular Coder

 
Join Date: May 2003
Location: Stockholm, Sweden
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Speedy is an unknown quantity at this point
Dynamicly generated forms?

I wanna enter a number in a input field so that when it's
submited it will generate a form with that number of rows,
is this possible?

I have this code:

admin.asp

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Admin Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<center>
<form method="post" action="signup.asp">
<table border="1" style="border-collapse: collapse" bordercolor="#000000">
  <tr>
    <td width="50" align="center"><b>Add</b></td>
	<td width="100" align="center"><input type="text" size="10" name="amount"></td>
	<td width="50"><input type="submit" value="Generate Sign Up Form"></td>
  </tr>
</table>
</form>
</center>
</body>
</html>
signup.asp

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sign Up Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<center>
<FORM METHOD="POST" ACTION="add.asp">
<table border="1" style="border-collapse: collapse" bordercolor="#000000">
  <tr>
    <td>ID</td>
	<td>First Name</td>
	<td>Last Name</td>
	<td>Team</td>
	<td>Hcp</td>
  </tr>
  <tr>
    <td><INPUT TYPE="TEXT" SIZE="30" NAME="ID"></td>
	<td><INPUT TYPE="TEXT" SIZE="30" NAME="Fname"></td>
	<td><INPUT TYPE="TEXT" SIZE="30" NAME="Lname"></td>
	<td><INPUT TYPE="TEXT" SIZE="30" NAME="Team"></td>
	<td><INPUT TYPE="TEXT" SIZE="30" NAME="Hcp"></td>
  </tr>
  <tr align="left">
    <td colspan="5">
    <INPUT TYPE="submit" VALUE="Add Post(s)"> 
	</td>
  </tr>
</FORM>
</center>
</body>
</html>
/Speedy
Speedy is offline   Reply With Quote
Old 11-07-2003, 09:55 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
Yeah it is possible....Just need to post the page to another page or itself and run a loop that builds the form.
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 11-07-2003, 10:09 PM   PM User | #3
Speedy
Regular Coder

 
Join Date: May 2003
Location: Stockholm, Sweden
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Speedy is an unknown quantity at this point
Ok,

so how does the loop look like then?

how do I tell the loop how many loops it shall do?

/Speedy
Speedy is offline   Reply With Quote
Old 11-08-2003, 02:04 AM   PM User | #4
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
get the value from the query string or the form element

then do a for loop with the value found above

Request.Write "your form element1"
Request.Write "your form element2"
Request.Write "your form element3"

next


That is the basic idea.......

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 11-08-2003, 02:50 PM   PM User | #5
M@rco
Regular Coder

 
Join Date: Oct 2003
Location: London, UK
Posts: 411
Thanks: 0
Thanked 1 Time in 1 Post
M@rco is an unknown quantity at this point
You could also do this without a client-server roundtrip by dynamically building a form in JS, but cross-browser compatibility would still be a pain, so building the form in ASP probably is the quickest & easiest solution for you.
__________________
Marcus Tucker / www / blog
Web Analyst Programmer / Voted SPF "ASP Guru"
M@rco is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:55 AM.


Advertisement
Log in to turn off these ads.