WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2004, 05:26 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default Multi-Page Forms

Hello!

I would like to create a form that is spread out over several pages. I do not want to create seperate forms for each page, since information users enter could get mixed up with someone else's information. Is there a way I can do this without asking the user for their "ID" every page?

Thanks,
Mike
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
  #2 (permalink)  
Old 06-23-2004, 06:31 PM
ADAM Web Design's Avatar
WebProWorld 1,000+ Club
 

Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
ADAM Web Design RepRank 0
Default

There are a few ways that this could be accomplished. The exact nature of this would depend on your programming language, but the concepts would remain the same:
  1. Session variables/Cookies. A cookie/session variable housing the appropriate could be read from a user's computer and processed as needed. If cookies are disabled, this functionality would be disabled as well.
  2. Querystring. Pass the user id from one form to the next via querystring. The problem with this method is that someone, either by accident or on purpose, could elect to alter the querystring and thus cause processing errors within the form.
  3. Hidden form input. This is the one I personally prefer. A hidden form field would generally be more trouble to modify than it's worth, and in the case of a multi-part form would have to be isolated and modified multiple times. Mind you, this is only true if you're POSTing your form information. Do not GET your form information, or you will end up with a querystring that, as stated above, can be manipulated.
Hope this helps.
Reply With Quote
  #3 (permalink)  
Old 06-23-2004, 09:08 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default

Thanks for the answer! If it's not too much to ask, could you demonstrate the "query-string"?

Regards,
Mike
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
  #4 (permalink)  
Old 06-24-2004, 02:26 AM
WebProWorld Member
 

Join Date: May 2004
Location: UK
Posts: 83
M0rtym0use RepRank 0
Default

{Page1}
<form action="page2.html?id=123&<%=Request.Form("var1")% ><%=Request.Form("var2")%>" method="post">
<input type="text" name="var1">
<input type="text" name="var2">
<input type="submit" name="Submit">
</form>
to reference the value on page 2...
<%
strID = Request.Querysting("id")
%>
MM
__________________
M0rtyM0use

Simply Rugby
Reply With Quote
  #5 (permalink)  
Old 06-24-2004, 08:08 AM
DOA DOA is offline
WebProWorld Member
 

Join Date: May 2004
Location: UK
Posts: 36
DOA RepRank 0
Default

This can also be done using Javascript and <span> tags. E.G

<form method="post" action="process.asp">

<span id="page1" style="display: inline">

</span>

<span id="page2" style="display: none">

</span>

<span id="page3" style="display: none">

</span>

</form>

When the page first loads, only the fields in the "page1" span ae visible. To move between "pages", you need a button or similar that when clicked loads a javascript function. The function hides the "page1" area and shows the "page2" area eg:
page1.style.display = "none";
page2.style.display = "inline";

This can me modified to include as many pages as you need. If you need a working example let me know and i'll knock one up for you.

Mike
__________________
Change is inevitable....except from vending machines
Reply With Quote
  #6 (permalink)  
Old 06-24-2004, 04:11 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default

Yes, please. If it's not a problem, please show me an example.

Thanks to everyone who's tried to help! :-)

Regards,
Mike
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
  #7 (permalink)  
Old 06-24-2004, 06:20 PM
DOA DOA is offline
WebProWorld Member
 

Join Date: May 2004
Location: UK
Posts: 36
DOA RepRank 0
Default

As promised, the example can be found at http://uk.geocities.com/mike.smith76@btinternet.com/

Its all javascript so you can do a view source to get the code. The only problem is its hosted on a free geocities / yahoo server, so they've added their guff at the end of the page.

All you have to do is add the fields you want to each <span> section, i recently created an online application form with 7 pages and around 50 fields using this method, so there doesnt seem to be a limit.

Any questions give me a shout on mike.smith76@btinternet.com

Mike
__________________
Change is inevitable....except from vending machines
Reply With Quote
  #8 (permalink)  
Old 06-24-2004, 07:46 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default

Thanks so much! :-) I'll try it out ASAP!

Regards,
Mike
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
  #9 (permalink)  
Old 06-25-2004, 02:36 AM
DOA DOA is offline
WebProWorld Member
 

Join Date: May 2004
Location: UK
Posts: 36
DOA RepRank 0
Default

No problem, hope it helps

Mike
__________________
Change is inevitable....except from vending machines
Reply With Quote
  #10 (permalink)  
Old 06-25-2004, 06:00 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default

Do I remove onSubmit="return false" from the form?
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
  #11 (permalink)  
Old 06-25-2004, 11:48 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default

Oh, by the way, I changed my username to "WiseWizards". Incase you don't remember, my original username was "MikeysTown".

Regards,
Mike
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
  #12 (permalink)  
Old 06-27-2004, 07:04 AM
DOA DOA is offline
WebProWorld Member
 

Join Date: May 2004
Location: UK
Posts: 36
DOA RepRank 0
Default

yes I put that line there to stop the form being submitted, as its not getting submitted to anything. When you make a live form this should be removed.

So hows the form going, run into any problems?

Mike
__________________
Change is inevitable....except from vending machines
Reply With Quote
  #13 (permalink)  
Old 06-27-2004, 03:31 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default

No problems yet, of course I haven't really completed it yet. I just finished planning my fields. Thanks for the reply, though. I'll reply soon to tell you my outcome.

Regards,
Mike
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
  #14 (permalink)  
Old 06-27-2004, 04:13 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default

I was wondering, is it possible to use this script to change which page a user goes to according to which button they hit?

I would like the user to enter their personal info on the first page, then the next page displays the packages we offer. To the right of each package will be a button that says "Purchase". Finally, I want the third page to be based off the second page's package selection.

For example, if a user selects "Basic" on the second page, they'll go to a page that asks the usual stuff, but if they select "Pro" on the second page, they'll go to a page that asks special pro stuff. I would still like to keep all this in the same form, like before, so is this possible?

Kindly,
Mike

P.S. Also, if I wanted to create more pages, I could just copy the page2 script, right?
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
  #15 (permalink)  
Old 06-28-2004, 03:23 PM
DOA DOA is offline
WebProWorld Member
 

Join Date: May 2004
Location: UK
Posts: 36
DOA RepRank 0
Default

Yes to add more pages just copy the page 2 bit, and change the values in the nextPage() and backPage() functions (onClick on the buttons).

As for the second part of your query, you could use html radio buttons to allow a user to select basic or pro. When a user clicked the next button on this particular page the javascript would check the value of this checkbox, and display the appropriate span tag.

Just one more thing, this code only seems to work in Internet Explorer, only just downloaded Mozilla and it doesn't seem to want to play.
__________________
Change is inevitable....except from vending machines
Reply With Quote
  #16 (permalink)  
Old 06-28-2004, 08:59 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: United States of America
Posts: 137
WiseWizards RepRank 0
Default

Thanks! I think I have everything!

Regards,
Mike
__________________
Wise WizardsŪ Website Design :: Professionally Designed Websites at Affordable Prices
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: ,



Thread Tools
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

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


Search Engine Optimization by vBSEO 3.2.0