Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Multi-page registration form... suggestions?


Message #1 by "Alvin Ling" <alvin.ling@i...> on Thu, 7 Feb 2002 13:47:11 -0500
I have a multi-page registration form (user steps through 5 pages) to

create an account.  In classic ASP, values were passed and retrieved

using Response.Form.  With the preferred .Net method of posting back,

what would be the best way to accomplish this?  



Creating a single large registration form isn't an option since form

elements on certain steps depend on values chosen in prior steps.





Alvin









Message #2 by "Garland Frye" <gfrye@s...> on Thu, 7 Feb 2002 13:21:03 -0600
Two ways that I can think of...



1. Before you leave a form store the values in a session variable

(c# Session[FormData] = SomeValue)



2. Add the values to the address as parameters



private sub btnNext_Click(object sender, System.EventArgs e)

{

    Response.Redirect("NextForm.aspx?" + "VARIABLE=" + MyVar.ToString()

}



once you are on the next page you can say...

Page_Load(object sender, System.EventArgs e)

{

    string sVar

    sVar = Request.QueryString("VARIABLE")

}



and there you have it...

"Alvin Ling" <alvin.ling@i...> wrote in message

news:143995@a...

>

> I have a multi-page registration form (user steps through 5 pages) to

> create an account.  In classic ASP, values were passed and retrieved

> using Response.Form.  With the preferred .Net method of posting back,

> what would be the best way to accomplish this?

>

> Creating a single large registration form isn't an option since form

> elements on certain steps depend on values chosen in prior steps.

>

>

> Alvin

>

>

>

>

>

>





Message #3 by "William J Ryan" <wryan@u...> on Thu, 7 Feb 2002 13:43:10 -0600
I'm also creating a multi part/page form.  I first tried panels (9)

until I realized that I'd have to enclose them all within one set of

form tags.  I've since switched to 9 separate pages.  I have a control

at the top of each page which is used as a navigation bar between parts.

It queries the database to determine which parts are required (data from

"entry point"). 



	On individual pages if there is some criteria dependent on a

value in the same page I use autopostback=3Dtrue for the "criteria"

control.  I have three buttons at the bottom of each page which allow

the user to save, save and continue to the next page or cancel the

current changes (for the current page only, since they have to save the

page in order to get to the next page).



	I also have a couple dynamically created links to popup pages

which allow users to select items from other parts of the database to

link to the form/report.  The Navigation control reduced the need for a

lot of URL passing between pages since I now just pass the ReportID and

UserID to the navigation control and let it grab the data from the

database at the start of each new section.  (For my situation, there

won't be a great amount people completing this report, and those that

do, will only do so once per year on a renewal basis.  Therefore, I

haven't been too concerned with scalability issues, but more with

simplifying the coding.)



Bill Ryan

wryan@u...



> -----Original Message-----

> From: Alvin Ling [mailto:alvin.ling@i...]

> Sent: Thursday, February 07, 2002 12:47 PM

> To: ASP+

> Subject: [aspx] Multi-page registration form... suggestions?

>

>

> I have a multi-page registration form (user steps through 5

> pages) to create an account.  In classic ASP, values were

> passed and retrieved using Response.Form.  With the preferred

> .Net method of posting back, what would be the best way to

> accomplish this? 

>

> Creating a single large registration form isn't an option

> since form elements on certain steps depend on values chosen

> in prior steps.

>

>

> Alvin

>

>

>

>

>




>

Message #4 by "Chris Kersey" <ckersey@m...> on Thu, 7 Feb 2002 12:15:41 -0800
I woudn't use the GET method (response.redirect?...) to pass information on

multiple forms like this because the GET will only handle a few Kilobytes of

information.  If each form has a text field, the querystring could reach the

limit fairly quickly and IIS will begin to complain when it reaches it's

threshold.



You're better off keeping all of the information in hidden fields as POST

does not have a limit (well, no unreasonable limit anyways).



Here is a possible solution, however I wouldn't consider it a "walk in the

park" to write.  I recently wrote a .dll that did the following in visual

basic.  This wasn't a Dot Net solution, so it would have to be re-written to

think in terms of events and webform controls, but I wouldn't consider it

too hard to implement in a week's time.



Since you're only dealing with about 5 forms (seems like a lot I know), you

can keep a hidden field of type integer that starts at 1 (or zero based,

whichever), that keeps track of "what form" you're on.  Each time you post

back to your form, if it's a postback, you can check the validity of the

fields.  If the fields are validated, then you can increment your hidden

field value.  Based on the value of the form field, you can select the

appropriate "select case (vb)" or "switch(int c){} (c#)" to execute.  Each

case can then be responsible for displaying a form that you can define in a

user control that is responsible for determining what data and form fields

are presented based on the previous form's input.  Each form will need to

house the current step (or form number) you are viewing and pass that value

on to the next form.



You can have a Next button which if clicked, will cause the counter to

increment (if no fields raised errors), a Previous Button that causes the

counter to decrement.  The increment and decrement would need to happen

*before* your post back hits the select statement so that it knows which

form to display.



Depending on whether you want to give the user the ability to quit the

process and resume from where they left off at a later time or not, you can

do one of the following:



*** Don't allow user to resume ***

1.  When you reach the final step (form number 5), the last submission

should increment your counter to step 6 that does all of the processing

(inserting/updating values) in the data store you're using.  Doing it this

way, if a user decides to flunk out, you don't have meaningless information

stored in your database.



*** Save Settings for Later:  User resumes where left off ***

2.  If you want the information to be storable for future use however, you

might want to insert the information on each step, and re-bind any values

from the database as the user returns.



oye ve... am I long winded or what?

chris



----- Original Message -----

From: "Garland Frye" <gfrye@s...>

Newsgroups: aspx

To: "ASP+" <aspx@p...>

Sent: Thursday, February 07, 2002 11:21 AM

Subject: [aspx] Re: Multi-page registration form... suggestions?





> Two ways that I can think of...

>

> 1. Before you leave a form store the values in a session variable

> (c# Session[FormData] = SomeValue)

>

> 2. Add the values to the address as parameters

>

> private sub btnNext_Click(object sender, System.EventArgs e)

> {

>     Response.Redirect("NextForm.aspx?" + "VARIABLE=" + MyVar.ToString()

> }

>

> once you are on the next page you can say...

> Page_Load(object sender, System.EventArgs e)

> {

>     string sVar

>     sVar = Request.QueryString("VARIABLE")

> }

>

> and there you have it...

> "Alvin Ling" <alvin.ling@i...> wrote in message

> news:143995@a...

> >

> > I have a multi-page registration form (user steps through 5 pages) to

> > create an account.  In classic ASP, values were passed and retrieved

> > using Response.Form.  With the preferred .Net method of posting back,

> > what would be the best way to accomplish this?

> >

> > Creating a single large registration form isn't an option since form

> > elements on certain steps depend on values chosen in prior steps.

> >

> >

> > Alvin

> >

> >

> >

> >

> >

> >

>

>

>




>



Message #5 by "McCloy, Russell" <Russell.McCloy@B...> on Fri, 8 Feb 2002 07:43:49 +1100
Isn't there a better way?

These two ways are the only ways I can think of.



RuSs





-----Original Message-----

From: Garland Frye [mailto:gfrye@s...]

Sent: Friday, 8 February 2002 6:21 AM

To: ASP+

Subject: [aspx] Re: Multi-page registration form... suggestions?





Two ways that I can think of...



1. Before you leave a form store the values in a session variable

(c# Session[FormData] = SomeValue)



2. Add the values to the address as parameters



private sub btnNext_Click(object sender, System.EventArgs e)

{

    Response.Redirect("NextForm.aspx?" + "VARIABLE=" + MyVar.ToString()

}



once you are on the next page you can say...

Page_Load(object sender, System.EventArgs e)

{

    string sVar

    sVar = Request.QueryString("VARIABLE")

}



and there you have it...

"Alvin Ling" <alvin.ling@i...> wrote in message

news:143995@a...

>

> I have a multi-page registration form (user steps through 5 pages) to

> create an account.  In classic ASP, values were passed and retrieved

> using Response.Form.  With the preferred .Net method of posting back,

> what would be the best way to accomplish this?

>

> Creating a single large registration form isn't an option since form

> elements on certain steps depend on values chosen in prior steps.

>

>

> Alvin

>

>

>

>

>

>











  Return to Index