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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding a Cancel button in an asp file

Status
Not open for further replies.

buspass01

Programmer
Joined
Nov 18, 2002
Messages
5
Location
US
I have created a form on my opening page. My next page (page2.asp) varify's the user's information that the put in the form. I need to provide the user with a cancel button on (page2.asp) that will take them back to the form which will be clear.

Can someone help me with coding this???

<%@LANGUAGE=&quot;JAVASCRIPT&quot; CODEPAGE=&quot;CP_ACP&quot;%>
<html>
<head>
<title>page2.asp</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>Chisels Ordered: <%= 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/thankorder.asp&quot; METHOD=&quot;post&quot; ENCTYPE=&quot;type/plain&quot; NAME=&quot;secpage&quot;
onSubmit=&quot;document.secpage.submit()&quot;
onReset=&quot;return confirmReset();&quot;>

<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;>
</form>
</body>
</html>
 
This code need to be client-side (remove delimiters <% & %>):

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


Another problem I see is that the form on this page has no fields. When you post it, all the data that you display to the user are not in form fields and cannot be posted to your form handler... You need to rewrite each value in a hidden input box in your form. -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top