...

View Full Version : Dynamicly generated forms?



Speedy
11-07-2003, 10:20 PM
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



<?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



<?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

A1ien51
11-07-2003, 10:55 PM
Yeah it is possible....Just need to post the page to another page or itself and run a loop that builds the form.

Speedy
11-07-2003, 11:09 PM
Ok,

so how does the loop look like then?

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

/Speedy

A1ien51
11-08-2003, 03:04 AM
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

M@rco
11-08-2003, 03:50 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum