By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,599 Members | 1,678 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,599 IT Pros & Developers. It's quick & easy.

Using Javascript to branch from one asp page to another and return

P: n/a
Hi,

I'm relatively new to Javascript so please bear with me on what
might sound like silly questions.

This is what I want to do:
I'm working in classic asp (I have to for this project). I need
to:
1. Click a submit button on an asp page, calling another page
that saves the contents of that form to a database and then displays
some information from the form. Obviously this part is simple. So
let's call these two forms form1 and form2.

2. Here's the part I don't understand. Sometime after the
user clicks the submit button, I would like the user to see a
confirmation message asking them if they want to do a certain task
that. If the user says "yes" I want the code to branch off to a third
asp page (form3), do an update to one specific field in the database,
and then return to the calling code.

I've considered having this occur right when the user clicks the
submit button (on form1; this would mean that after the execuation of
form3 the program would return to form1.But it occurred to me that it
would be better to have the code save the form contents to the
database before the confirmation message comes up; this would mean
that the program would return to form2 after executing form3. I'm not
sure which is best

I'm not really used to "branching" using javascript. What needs to
happen is the code needs to branch to form3 (depending on if the user
clicks "yes" in the confirmation box) and then the program needs to
return to the calling asp page to continue the original processing.
Also the form fields need to be available to the calling asp page as
"request.form" variables(after the return from form3) so that it can
continue it's work.

The only thing I've seen that runs an asp page and then returns is
"sever.execute". This is a vbscript command for ie as far as I know
and I'm wondering if there is something similar in javascript. I would
suppose it would be like "window.location".

Any help would be appreciated. I am open to some other method of
doing this than I've outlined here. I feel I've probably missed
something.

Neil
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Once the first form is submitted you can no longer get any input from the
user on that page. If you do not want to include your question in the
client-side validation of the first form then you will have to generate and
intermediate page to ask your question after updating the database.

form1 submits to form1processor
form1processor generates html that asks your questions and either
on "yes" submits data to form3
on "no" opens form2

form3 goes to form2 as the final result of being submitted

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"fig000" <ne***********@yahoo.com> wrote in message
news:ea**************************@posting.google.c om...
Hi,

I'm relatively new to Javascript so please bear with me on what
might sound like silly questions.

This is what I want to do:
I'm working in classic asp (I have to for this project). I need
to:
1. Click a submit button on an asp page, calling another page
that saves the contents of that form to a database and then displays
some information from the form. Obviously this part is simple. So
let's call these two forms form1 and form2.

2. Here's the part I don't understand. Sometime after the
user clicks the submit button, I would like the user to see a
confirmation message asking them if they want to do a certain task
that. If the user says "yes" I want the code to branch off to a third
asp page (form3), do an update to one specific field in the database,
and then return to the calling code.

I've considered having this occur right when the user clicks the
submit button (on form1; this would mean that after the execuation of
form3 the program would return to form1.But it occurred to me that it
would be better to have the code save the form contents to the
database before the confirmation message comes up; this would mean
that the program would return to form2 after executing form3. I'm not
sure which is best

I'm not really used to "branching" using javascript. What needs to
happen is the code needs to branch to form3 (depending on if the user
clicks "yes" in the confirmation box) and then the program needs to
return to the calling asp page to continue the original processing.
Also the form fields need to be available to the calling asp page as
"request.form" variables(after the return from form3) so that it can
continue it's work.

The only thing I've seen that runs an asp page and then returns is
"sever.execute". This is a vbscript command for ie as far as I know
and I'm wondering if there is something similar in javascript. I would
suppose it would be like "window.location".

Any help would be appreciated. I am open to some other method of
doing this than I've outlined here. I feel I've probably missed
something.

Neil

Jul 19 '05 #2

P: n/a
Mark,

Thanks for answering. I realize that I probably didn't myself clear
enough. The steps I want to follow are:

1. form1 submits to form1processor
2. Somewhere at this point (perhaps in the submit button code of form1
or somewhere in form1processer) the javascript confirm comes up asking
the question:
"Do you want to do task 2?"
If they choose "yes" execution goes to form3. Then execution is
passed to form2.
(By the way Form3 doesn't get the data from form1; it does something
else having nothing to do with form1. I tried doing this
ansynchronously by opening form3 using javascript and having it close
itself but our standard popup blocker prevented this).

If they choose "no" execution goes to form2.

So either way we end up at form 2. It seems to me that the issue here
is that unlike other languages, asp is not really good at doing things
asynchronously.

Thanks,
Neil

"Mark Schupp" <ms*****@ielearning.com> wrote in message news:<OK**************@TK2MSFTNGP12.phx.gbl>...
Once the first form is submitted you can no longer get any input from the
user on that page. If you do not want to include your question in the
client-side validation of the first form then you will have to generate and
intermediate page to ask your question after updating the database.

form1 submits to form1processor
form1processor generates html that asks your questions and either
on "yes" submits data to form3
on "no" opens form2

form3 goes to form2 as the final result of being submitted

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"fig000" <ne***********@yahoo.com> wrote in message
news:ea**************************@posting.google.c om...
Hi,

I'm relatively new to Javascript so please bear with me on what
might sound like silly questions.

This is what I want to do:
I'm working in classic asp (I have to for this project). I need
to:
1. Click a submit button on an asp page, calling another page
that saves the contents of that form to a database and then displays
some information from the form. Obviously this part is simple. So
let's call these two forms form1 and form2.

2. Here's the part I don't understand. Sometime after the
user clicks the submit button, I would like the user to see a
confirmation message asking them if they want to do a certain task
that. If the user says "yes" I want the code to branch off to a third
asp page (form3), do an update to one specific field in the database,
and then return to the calling code.

I've considered having this occur right when the user clicks the
submit button (on form1; this would mean that after the execuation of
form3 the program would return to form1.But it occurred to me that it
would be better to have the code save the form contents to the
database before the confirmation message comes up; this would mean
that the program would return to form2 after executing form3. I'm not
sure which is best

I'm not really used to "branching" using javascript. What needs to
happen is the code needs to branch to form3 (depending on if the user
clicks "yes" in the confirmation box) and then the program needs to
return to the calling asp page to continue the original processing.
Also the form fields need to be available to the calling asp page as
"request.form" variables(after the return from form3) so that it can
continue it's work.

The only thing I've seen that runs an asp page and then returns is
"sever.execute". This is a vbscript command for ie as far as I know
and I'm wondering if there is something similar in javascript. I would
suppose it would be like "window.location".

Any help would be appreciated. I am open to some other method of
doing this than I've outlined here. I feel I've probably missed
something.

Neil

Jul 19 '05 #3

P: n/a
It is not vbscript or ASP that is your problem. It is the nature of HTTP
that you have to work around.

HTTP is a connectionless protocol that consists of requests and responses.
The browser sends a request and the server returns a response. By the time a
page displays in the browser, all processing is complete on the server. Any
further operation on the server requires a request from the browser. If you
do not want to include the question about the optional processing in the
validation of the original form then the form processing script must return
an HTML page to ask the question. Then another request must be made to the
server to perform the "form3" processing.

If you want to have form2 ask the question and trigger form3 on the server
then you will have to send another request. You could have javascript send
the request and target a hidden frame window if you can use frames or you
can have form3 "bounce" back to form2 in the main window. You could also do
something with a component loaded on the page to send the request
transparently (MSXML2.XMLHTTP for IE, a Java Applet for others).

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"fig000" <ne***********@yahoo.com> wrote in message
news:ea**************************@posting.google.c om...
Mark,

Thanks for answering. I realize that I probably didn't myself clear
enough. The steps I want to follow are:

1. form1 submits to form1processor
2. Somewhere at this point (perhaps in the submit button code of form1
or somewhere in form1processer) the javascript confirm comes up asking
the question:
"Do you want to do task 2?"
If they choose "yes" execution goes to form3. Then execution is
passed to form2.
(By the way Form3 doesn't get the data from form1; it does something
else having nothing to do with form1. I tried doing this
ansynchronously by opening form3 using javascript and having it close
itself but our standard popup blocker prevented this).

If they choose "no" execution goes to form2.

So either way we end up at form 2. It seems to me that the issue here
is that unlike other languages, asp is not really good at doing things
asynchronously.

Thanks,
Neil

"Mark Schupp" <ms*****@ielearning.com> wrote in message

news:<OK**************@TK2MSFTNGP12.phx.gbl>...
Once the first form is submitted you can no longer get any input from the user on that page. If you do not want to include your question in the
client-side validation of the first form then you will have to generate and intermediate page to ask your question after updating the database.

form1 submits to form1processor
form1processor generates html that asks your questions and either
on "yes" submits data to form3
on "no" opens form2

form3 goes to form2 as the final result of being submitted

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"fig000" <ne***********@yahoo.com> wrote in message
news:ea**************************@posting.google.c om...
Hi,

I'm relatively new to Javascript so please bear with me on what
might sound like silly questions.

This is what I want to do:
I'm working in classic asp (I have to for this project). I need
to:
1. Click a submit button on an asp page, calling another page
that saves the contents of that form to a database and then displays
some information from the form. Obviously this part is simple. So
let's call these two forms form1 and form2.

2. Here's the part I don't understand. Sometime after the
user clicks the submit button, I would like the user to see a
confirmation message asking them if they want to do a certain task
that. If the user says "yes" I want the code to branch off to a third
asp page (form3), do an update to one specific field in the database,
and then return to the calling code.

I've considered having this occur right when the user clicks the
submit button (on form1; this would mean that after the execuation of
form3 the program would return to form1.But it occurred to me that it
would be better to have the code save the form contents to the
database before the confirmation message comes up; this would mean
that the program would return to form2 after executing form3. I'm not
sure which is best

I'm not really used to "branching" using javascript. What needs to
happen is the code needs to branch to form3 (depending on if the user
clicks "yes" in the confirmation box) and then the program needs to
return to the calling asp page to continue the original processing.
Also the form fields need to be available to the calling asp page as
"request.form" variables(after the return from form3) so that it can
continue it's work.

The only thing I've seen that runs an asp page and then returns is
"sever.execute". This is a vbscript command for ie as far as I know
and I'm wondering if there is something similar in javascript. I would
suppose it would be like "window.location".

Any help would be appreciated. I am open to some other method of
doing this than I've outlined here. I feel I've probably missed
something.

Neil

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.