Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Buttons on a confimation asp page

Status
Not open for further replies.

buspass01

Programmer
Nov 18, 2002
5
US
I am creating a webpage that the opening page is a form. When you click the submit button on the form you go to the receiveorderform.asp that returns the values entered in the form on the opening page...

I need help creating a code for the receiveorderform.asp which includes a confirm button that takes the visitor to a Thank you for ordering page and a button that cancels the order and wipes out the values enter in the form and returns them to the first page. Below is the code for the
receiveorderform.asp page

Thanks in advance!


<%@LANGUAGE=&quot;JAVASCRIPT&quot; CODEPAGE=&quot;CP_ACP&quot;%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<%

function confirmReset() {
var resetForm = confirm(
&quot;Are you sure you want to reset the form?&quot;);
if (resetForm == true)
return true;
return false;
}

%>
</head>

<body>
<H2> Products Ordered:</H2>
<P>Hammers Ordered: <%= Request.Form(&quot;hammers&quot;) %></P>
<P>Clamps Ordered: <%= Request.Form(&quot;clamps&quot;) %></P>
<P>Torches Ordered: <%= Request.Form(&quot;torches&quot;) %></P>
<P>Axes Ordered: <%= Request.Form(&quot;axes&quot;) %></P>
<P>Name: <%= Request.Form(&quot;chisels&quot;) %></P>
<H2>Billing Information:</H2>
<P>Name: <%= Request.Form(&quot;name&quot;) %></P>
<P>Billing Address: <%= Request.Form(&quot;address&quot;) %></P>
<P>Shipping Address: <%= Request.Form(&quot;address2&quot;) %></P>
<P>City: <%= Request.Form(&quot;city&quot;) %></P>
<P>State: <%= Request.Form(&quot;state&quot;) %></P>
<P>Zip: <%= Request.Form(&quot;zip&quot;) %></P>
<P>Phone Number: <%= Request.Form(&quot;phone&quot;) %></P>
<P>Email Address: <%= Request.Form(&quot;email&quot;) %></P>
<P>Credit Card Type: <%= Request.Form(&quot;creditcard&quot;) %></P>
<P>Credit Card Number: <%= Request.Form(&quot;ccnum&quot;) %></P>
<P>Expiration Date: <%= Request.Form(&quot;expdate&quot;) %></P>
<FORM ACTION=&quot;file:///C|/MyWebSites/INFO250/Exercise10/Tutorial.10/thankyou.htm&quot; METHOD=&quot;post&quot; ENCTYPE=&quot;type/plain&quot; NAME=&quot;secpage&quot;
onSubmit=&quot;return submitForm();&quot;
onReset=&quot;return confirmReset();&quot;>
<INPUT TYPE=&quot;button&quot; NAME=&quot;cancel_button&quot; Value=&quot;Cancel&quot;>
<INPUT TYPE=&quot;button&quot; NAME=&quot;confirm_button&quot; Value=&quot;Confirm&quot;></form>
</body>
</html>

 
I have bad news. You cannot use alert or confirm dialogs server side. the best way to do this is to do it via client side in the form onSubmit. Or you can do a onLoad in this page above again client side.

A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
here's what I would try out.
palce all the form values passed into hidden form fields. use client side javascript to ask if they hit cancel if they are sure. on that redirect as needed. then if they confirm it submit the form as you do and have another page to process the form as normal.
example
<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<html>
<head>
<title>Untitled Document</title>
<script language=&quot;javascript&quot;>
function confirmReset() {
var resetForm = confirm(&quot;Are you sure you want to reset the form?&quot;);
if (resetForm == true) {
return true;
window.location=&quot;somewhere.asp&quot;
} else {
return false;
window.location=&quot;somewhere.asp&quot;
}
}
</script>
</head>
<body>
<FORM ACTION=&quot;actual processing script.asp&quot; METHOD=&quot;post&quot; NAME=&quot;secpage&quot; onSubmit=&quot;return submitForm()&quot; onReset=&quot;return confirmReset()&quot;>
<H2> Products Ordered:</H2>
<P>Hammers Ordered:<input type=&quot;hidden&quot; name=&quot;hammers&quot; value=&quot;<%= Request.Form(&quot;hammers&quot;) %>&quot;></P>
<INPUT TYPE=&quot;button&quot; NAME=&quot;cancel_button&quot; Value=&quot;Cancel&quot;>
<INPUT TYPE=&quot;submit&quot; NAME=&quot;confirm_button&quot; Value=&quot;Confirm&quot;>
</form>
</body>
</html>


Note: I did not test this, I'm just trying to let you know what I mean A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
one more thing. your buttons should be the submit and reset or the events will never be called as you are calling them.
ie
<INPUT TYPE=&quot;reset&quot; NAME=&quot;cancel_button&quot; Value=&quot;Cancel&quot;>
<INPUT TYPE=&quot;submit&quot; NAME=&quot;confirm_button&quot; Value=&quot;Confirm&quot;> A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
alright another thing.
change the onSubmit to
onSubmit=&quot;document.secpage.submit()&quot; A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top