473,748 Members | 6,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.fo rm" 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.locatio n".

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 2340
Hi,

After you have processed and recorded all the data, try

Response.redire ct("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.fo rm" 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.locatio n".

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.locatio n".
I hope that clears it up. Any advice would be appreciated (from
anyone :-))

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

After you have processed and recorded all the data, try

Response.redire ct("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.fo rm" 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.locatio n".

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(th is.form)" value="OK">
</form>

<form name=F2 action="Foo2.as p">

</form>

<form name=F3 action="Foo3.as p">

</form>

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

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

function DoF2(){
// whatever
document.F2.sub mit()
// which will display another final page via Foo2.asp
}
</script>
Kien
ne***********@y ahoo.com (fig000) wrote in message news:<ea******* *************** ****@posting.go ogle.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.locatio n".
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*********@hot mail.com (Kien) wrote in message news:<16******* *************** ***@posting.goo gle.com>...
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(th is.form)" value="OK">
</form>

<form name=F2 action="Foo2.as p">

</form>

<form name=F3 action="Foo3.as p">

</form>

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

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

function DoF2(){
// whatever
document.F2.sub mit()
// which will display another final page via Foo2.asp
}
</script>
Kien
ne***********@y ahoo.com (fig000) wrote in message news:<ea******* *************** ****@posting.go ogle.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.locatio n".
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
2304
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 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
13
9648
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 assigned to a variable and output using document.write. (Note, there is no submit button or other form elements. Basically
7
3357
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. since the taxonomy is a rather long list, i'm hiding and showing divs for the secondary and tertiary links, so when a user clicks on the checkbox for the parent category, the children appear in a second (and third) div, with checkboxes of their...
8
33696
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 language=JavaScript runat=server>" alertScript &= "alert('" & msg & "');" alertScript &= "</script>"
2
3059
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 what I'm hoping to achieve. I've never before had to use Javascript closures, but now I do, so I'm making an effort to understand them. I've been giving this essay a re-read: http://jibbering.com/faq/faq_notes/closures.html
13
39439
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 there is a checkbox (v1) allowing to select that row for changes (e.g. delete, update, etc.) So we are creating an array of checkbox, correct ? Of course I have to check whether any of these checkboxes exist and if any of them got selected (checked)
0
1572
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 non english like áÁñÑnº1ªäÄà display like
26
3902
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 almost no posts from the last 3 years: http://groups.google.com/group/comp.lang.javascript/search?group=comp.lang.javascript&q=how+to+play+a+sound+with+Javascript&qt_g=Search+this+group Even after sorting by date, there don't appear any...
12
78013
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 give me some idea where I am going wrong ?? I just want to retrieve data from my emp_mstr table and display it using my JSP file... The table emp_mstr is as follows :- CREATE TABLE EMP_MSTR( EMP_NO VARCHAR(10) PRIMARY KEY, PASSWORD...
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8828
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9319
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.