473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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 23 '05 #1
4 2309
Hi,

After you have processed and recorded all the data, try

Response.redirect("form3.asp")

Kien
fig000 wrote:
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 23 '05 #2
Kien,

Thanks for answering. I understand what you are trying to say but
this is complicated by two things:

Here are the steps I need to follow. This should make thing clearer:
1. click the submit button on form1.
2. form2 is called and saves the form1 field data
3. A confirmation box comes up and asks if the user wants to do
"task2":
a. if the user clicks "yes we should branch to form3 which will do
"task2" (which in this case opens up one field in the database)
b. if the user clicks "no" form3 completes without doing anything.
4. Execution returns to form2 which THEN displays some data from form1
to show the user what was saved.

I need to ask a yes or no question to decide whether to branch to
form3 and using the javascript confirm is the only way I know to do
it. So I need a javascript command to go to form3 execute it, and then
return to form2(like the vbscript server.execute). I assume this would
be something along the lines of "window.location".
I hope that clears it up. Any advice would be appreciated (from
anyone :-))

Neil
Kien <ca*********@hotmail.com> wrote in message news:<OL*******************@news-server.bigpond.net.au>...
Hi,

After you have processed and recorded all the data, try

Response.redirect("form3.asp")

Kien
fig000 wrote:
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 23 '05 #3
Hi,

Once you go to a ASP script page you can't go back to the sending page
with the inputs intact - as it will reload and reset the forms.

How about doing it all client-side then only submit data at the end?

<form name=F1>
<input name=T1>
<input type=button onclick="Chk(this.form)" value="OK">
</form>

<form name=F2 action="Foo2.asp">

</form>

<form name=F3 action="Foo3.asp">

</form>

<script>
function Chk(F){
// whatever
if(confirm("Task2?"))DoF3()
else DoF2()
}

function DoF3(){
// whatever
document.F3.submit()
// which will save the database and display the final page via
Foo3.asp
}

function DoF2(){
// whatever
document.F2.submit()
// which will display another final page via Foo2.asp
}
</script>
Kien
ne***********@yahoo.com (fig000) wrote in message news:<ea**************************@posting.google. com>...
Kien,

Thanks for answering. I understand what you are trying to say but
this is complicated by two things:

Here are the steps I need to follow. This should make thing clearer:
1. click the submit button on form1.
2. form2 is called and saves the form1 field data
3. A confirmation box comes up and asks if the user wants to do
"task2":
a. if the user clicks "yes we should branch to form3 which will do
"task2" (which in this case opens up one field in the database)
b. if the user clicks "no" form3 completes without doing anything.
4. Execution returns to form2 which THEN displays some data from form1
to show the user what was saved.

I need to ask a yes or no question to decide whether to branch to
form3 and using the javascript confirm is the only way I know to do
it. So I need a javascript command to go to form3 execute it, and then
return to form2(like the vbscript server.execute). I assume this would
be something along the lines of "window.location".
I hope that clears it up. Any advice would be appreciated (from
anyone :-))

Neil

Jul 23 '05 #4
Kien,

This is making me realize I have to be clearer with my explanation
:-). Sorry for the repetition.

Thanks; You have shown me things I didn't know about javascript.
The one problem I have left is the fact that I always want form2 to
execute; it isn't an either or issue. The only optional execution is
form3 which is based on whether the user clicks yes on the confirm.

Here's the revised set of steps:
1. Click the submit button on form1
2. Form2 is executed; form2 saves the data from form1 AND then
displays some of the data from form1 on the screen; this must happen.
3. Somewhere in the execution of form2 (or in the submit button
code on form1) the confirmation box comes up asking the user if they
want to do task2:
a: if they click yes the execution branches to form3 which
executes another task. It should return to form2 (or at least not
interrupt the processing of form2) so they can see the displayed
field data from form1 on form2; you've pointed out that can't happen
because we would lose the field data in form1.

I've thought of other scenarios:

1.The confirmation comes up immediately on hitting the submit
button in hte submit button code of form1. Ths could would send the
user to form3 if they click yes. Then form2 is called. I don't think
this will work because once we go to form3 the field contents of form1
are lost.

2.The confirmation code (javascript) could open form3
asynchronously;form3 would do it's task and then close itself. The
flow of the submit on form1 to the saving and display on form2 would
be unaffected. This seemed to be the easiest way to do this until
someone told me that google popup blocker is standard on our machines;
when it tested this scenario, form3 was blocked when it was opened
:-).

One of the main problems seems to be the fact that:
1. I need javascript to do a confirm
2. Javascript has nothing like a server.execuate as in vbscript. So
once I leave one form, I can't resume execution of the previous one.

Thanks again for your help. Hopefully there's some way to do this.

Neil
ca*********@hotmail.com (Kien) wrote in message news:<16*************************@posting.google.c om>...
Hi,

Once you go to a ASP script page you can't go back to the sending page
with the inputs intact - as it will reload and reset the forms.

How about doing it all client-side then only submit data at the end?

<form name=F1>
<input name=T1>
<input type=button onclick="Chk(this.form)" value="OK">
</form>

<form name=F2 action="Foo2.asp">

</form>

<form name=F3 action="Foo3.asp">

</form>

<script>
function Chk(F){
// whatever
if(confirm("Task2?"))DoF3()
else DoF2()
}

function DoF3(){
// whatever
document.F3.submit()
// which will save the database and display the final page via
Foo3.asp
}

function DoF2(){
// whatever
document.F2.submit()
// which will display another final page via Foo2.asp
}
</script>
Kien
ne***********@yahoo.com (fig000) wrote in message news:<ea**************************@posting.google. com>...
Kien,

Thanks for answering. I understand what you are trying to say but
this is complicated by two things:

Here are the steps I need to follow. This should make thing clearer:
1. click the submit button on form1.
2. form2 is called and saves the form1 field data
3. A confirmation box comes up and asks if the user wants to do
"task2":
a. if the user clicks "yes we should branch to form3 which will do
"task2" (which in this case opens up one field in the database)
b. if the user clicks "no" form3 completes without doing anything.
4. Execution returns to form2 which THEN displays some data from form1
to show the user what was saved.

I need to ask a yes or no question to decide whether to branch to
form3 and using the javascript confirm is the only way I know to do
it. So I need a javascript command to go to form3 execute it, and then
return to form2(like the vbscript server.execute). I assume this would
be something along the lines of "window.location".
I hope that clears it up. Any advice would be appreciated (from
anyone :-))

Neil

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: fig000 | last post by:
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...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
7
by: adam | last post by:
i'm working on a portion of a CMS that allows content-admins to browse a product list, and add individual products into the taxonomy by clicking checkboxes next to categories they might belong in....
8
by: Dave | last post by:
Hello all, I have been able to use a Javascript alert box in my vb.net web application, for example: Dim msg As String = "Hello, world." Dim alertScript As String = "<script...
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
13
by: Oleg Konovalov | last post by:
Hi, I am working on a web application which among other things uses DHTML, Java and Javascript. It populates web page based on the contents of the database (resultset), and next to each row...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi I have two updatepanels on an asp.net page and when there is a postback from one updatepanel it changes the non english characters in the other and displays some crap instead. Characters...
26
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are...
12
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.