I am after some advice on the best way to handle multi page ASP forms.  I
have searched around a little and their seems to be three alternatives -
hidden fields, cookies or session variables.  What are the benefits or
disadvantages of each method in your opinion?  My form will be probably 5 or
so pages long, with around 20 fields per page.

You are presumably collecting these 100 or so items in order to build rows in database tables.


If you are getting your visitors to fill out something like a survey and the answers will all be written to a single row in a single table, then you might consider having all the items on a single page. Rather than clicking a button through the five pages, your users will just keeping scrolling down to a single button.

I tend to divide forms across pages based on some logic for the database. If I was building customer records, I might collect all the essential information for the customer table, then have a button, and have the same page (now receiving values, including that of the button) verify the values and re-display the form for any corrections. If everything was correct, I would write the main database row for the customer and then retrieve a unique customer id and hold that as a session variable. The navigation through other form pages would depend on choices made by the customer.

As ana example, my church database for donations collects the basic name and address information first, builds a record for that 'customer' and then asks for the method of giving, such as collection envelopes, automatic payments or credit cards. These are handled in different ways, using different tables, so they are different forms. There are also forms that are called up if the 'customer' wants to give to a variety of funds, so that they can make different donations or else have each single donation apportioned to various funds. I didn't really design the forms: the path through the questions designed them.

On the whole, I prefer using session variables, but as few as I can. If I can use only one, that's great. I don't use cookies as such, although session variables are pretty much the same as cookies in some circumstances. I dislike hidden fields because of the need to maintain logic for them through a series of pages that can change substantially to accommodate a small change as far as the visitor is concerned. I like things simple, and a single session variable suits my style fine.

You might also consider the possibility that a user may stop and bookmark a page (or just have it in history) and may try to return to it later. Will the logic based on hidden fields without any references to databases be able to cope with this? If you use a session variable that points to an existing record you can just check if it exists and abandon the whole transaction if it doesn't, with a polite message.

Regards,
David


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub


________________ http://www.wdvl.com _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to