...

View Full Version : form example



havey
07-07-2003, 01:32 PM
can someone show me a simple form example of a radio button form posting to another form and then to a third form, and the third form contains the value of the first and second - using seperate pages.

Thank for helping me understand and learn!

cheers

beetle
07-07-2003, 04:39 PM
This sort of multi-page form is best handled with a server-side language, and not javascript.

Cookies, the query-string, or session variables need to be used to accomplish this. Javascript can handle cookies and the query-string, but this is not a super-simple setup.

Also, doing this with javascript is incredibly insecure.

Thoughts?

havey
07-07-2003, 05:46 PM
security is not an issue for me. Why is handling variables client side so difficult with JavaScript?

could i use a .js file and inclue it with the pages, if so is there a JS script that acts like this VB script?:
<%
For Each thing In Request.Form
Response.Write "<input type=""hidden"" name=""" & thing & """ value=""" & Request.Form(thing) & """>" & vbCrLf
Next
%>

I can't use cookies or session variables, just the URL.

please inform

havey

beetle
07-07-2003, 06:14 PM
It's not difficult -- it just has a few stigmas ;)

How many pieces of data are we talking about here? The query-string could quickly become too large if you string together too many forms in this fashion.

havey
07-07-2003, 06:24 PM
these variables with their selected interger values, not exceeding into the triple digits, for example:
form1:
age=10
form2:
ada=34
form3:
edu=12
form4:
gua=5
form5:
lan=11
form6:
occ=16
form7:
reg=2
form8:
wor=6
form 9 displays values from all preceeding forms

havey
07-07-2003, 06:42 PM
like so:

form1:

<html>
<head>
<title>age</title>
</head>
<body>

<form>
<p>age10<input type="radio" value="10" checked name="age"></p>
<p>age5<input type="radio" name="age" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form2:

<html>
<head>
<title>ada</title>
</head>
<body>

<form>
<p>ada10<input type="radio" value="10" checked name="ada"></p>
<p>ada5<input type="radio" name="ada" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form3:

<html>
<head>
<title>edu</title>
</head>
<body>

<form>
<p>edu10<input type="radio" value="10" checked name="edu"></p>
<p>edu5<input type="radio" name="edu" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form4:

<html>
<head>
<title>gua</title>
</head>
<body>

<form>
<p>gua10<input type="radio" value="10" checked name="gua"></p>
<p>gua5<input type="radio" name="gua" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form5:

<html>
<head>
<title>lan</title>
</head>
<body>

<form>
<p>lan10<input type="radio" value="10" checked name="lan"></p>
<p>lan5<input type="radio" name="lan" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form6:

<html>
<head>
<title>occ</title>
</head>
<body>

<form>
<p>occ10<input type="radio" value="10" checked name="occ"></p>
<p>occ5<input type="radio" name="occ" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form7:

<html>
<head>
<title>reg</title>
</head>
<body>

<form>
<p>reg10<input type="radio" value="10" checked name="reg"></p>
<p>reg5<input type="radio" name="reg" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form8:

<html>
<head>
<title>wor</title>
</head>
<body>

<form>
<p>wor10<input type="radio" value="10" checked name="wor"></p>
<p>wor5<input type="radio" name="wor" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form9:
displayes values from forms 1 - 8

beetle
07-08-2003, 05:52 PM
This would be fairly easy to do using my Get class (http://www.peterbailey.net/dev/jsclasses/)

Basically, on every page except the first, you'd follow these steps

1) Initialize GetVars object
2) Loop through the form on the page and add values from the GetVars object

That's pretty much it. I know this description is very brief, so let me know if you need something more to go on.

beetle
07-08-2003, 06:05 PM
Here, I made a three page proof-of-concept (http://www.peterbailey.net/test/form1.htm) :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum