ASP/VBScript Form Help

I've got an online job application I am building using ASP/VBScript.
The application consists of one ASP document which has three separate
states.

States:

1. Form Display
2. Form Review (takes all information submitted from the first form
state and removes the form elements and displays entered information
using "Response.form()".
3. Displays "Thank You" page and emails form contents to a specific
email.

I am using Session variables to control the states of the form. So on
the first state, I set a Session variable (frmState) to "two" and the
second state sets the Session variable to "three". So, my ASP document
has an if/else statement controlled by the value of the Session
variable "frmState".

The issue I am having is if a user sees a mistake during the second
form state, they must click the "Back" button to return to the firsts
form state. However, the value of Session variable frmState is still
set for "three" which once the user re-submits the form, the second
form state is skipped and the third "Thank You" form state is displayed
and the user doesn't get a chance to re-check their inputted
information.

How can I setup the form (using VBScript) to reset the value of the
Session variable once the "Back" button is clicked?
It doesn't look like the ASP page is refreshed in any way, so the
Session variable always contains the wrong value.

Any help would be greatly appreciated.

--Dan

NOTE: This question was previously posted on "asp.net", but the amount
of answered questions at "asp.net" are much lower the here.

Advertisements

hermand wrote:
> I've got an online job application I am building using ASP/VBScript.
> The application consists of one ASP document which has three separate
> states.
>
> States:
>
> 1. Form Display
> 2. Form Review (takes all information submitted from the first form
> state and removes the form elements and displays entered information
> using "Response.form()".
> 3. Displays "Thank You" page and emails form contents to a specific
> email.
>
> I am using Session variables to control the states of the form. So on
> the first state, I set a Session variable (frmState) to "two" and the
> second state sets the Session variable to "three". So, my ASP document
> has an if/else statement controlled by the value of the Session
> variable "frmState".
>
> The issue I am having is if a user sees a mistake during the second
> form state, they must click the "Back" button to return to the firsts
> form state. However, the value of Session variable frmState is still
> set for "three" which once the user re-submits the form, the second
> form state is skipped and the third "Thank You" form state is displayed
> and the user doesn't get a chance to re-check their inputted
> information.
>
> How can I setup the form (using VBScript) to reset the value of the
> Session variable once the "Back" button is clicked?
> It doesn't look like the ASP page is refreshed in any way, so the
> Session variable always contains the wrong value.
>
> Any help would be greatly appreciated.
>
> --Dan
>
> NOTE: This question was previously posted on "asp.net", but the amount
> of answered questions at "asp.net" are much lower the here.

You can't use ASP to detect client-side events, such as button clicks,
but you could use hidden fields in the form to keep track of which
state it's in, rather than session variables.

That way, if someone does use their back button, when they resubmit the
form, it will be back to frmState="1".

Or, when you display the preview of what they are submitting, you could
also provide them with the form again, with the values from the
previous form already written to it so they can choose to submit again
or edit.

Advertisements

Guest

Or you could include a Back button on your page that submits to the
page again. And toward the top of the page check to see if the Back
button is <> "" and then adjust the session variable accordingly.

And for a semi-related link about checking to see what button was
clicked on:

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!