Go Back   CodingForums.com > :: Client side development > JavaScript programming

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 07-07-2003, 12:32 PM   PM User | #1
havey
Regular Coder

 
Join Date: Mar 2003
Posts: 165
Thanks: 0
Thanked 0 Times in 0 Posts
havey is an unknown quantity at this point
form example

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
havey is offline   Reply With Quote
Old 07-07-2003, 03:39 PM   PM User | #2
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
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?
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Old 07-07-2003, 04:46 PM   PM User | #3
havey
Regular Coder

 
Join Date: Mar 2003
Posts: 165
Thanks: 0
Thanked 0 Times in 0 Posts
havey is an unknown quantity at this point
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
havey is offline   Reply With Quote
Old 07-07-2003, 05:14 PM   PM User | #4
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
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.
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Old 07-07-2003, 05:24 PM   PM User | #5
havey
Regular Coder

 
Join Date: Mar 2003
Posts: 165
Thanks: 0
Thanked 0 Times in 0 Posts
havey is an unknown quantity at this point
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 is offline   Reply With Quote
Old 07-07-2003, 05:42 PM   PM User | #6
havey
Regular Coder

 
Join Date: Mar 2003
Posts: 165
Thanks: 0
Thanked 0 Times in 0 Posts
havey is an unknown quantity at this point
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

Last edited by havey; 07-07-2003 at 05:45 PM..
havey is offline   Reply With Quote
Old 07-08-2003, 04:52 PM   PM User | #7
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
This would be fairly easy to do using my Get class

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.
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Old 07-08-2003, 05:05 PM   PM User | #8
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
Here, I made a three page proof-of-concept
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle 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 06:11 AM.


Advertisement
Log in to turn off these ads.