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

Confirmation box in my ASP page

Status
Not open for further replies.

david7777777777

Programmer
Sep 26, 2001
417
US
I've been looking around in here and I think I've actually seen too much helpful information believe it or not. So here's all I need. This is for an ASP page talking to SQL 2000 using vbscript on the server.

I have a form and its submit button is already doing some things. I'd also like the submit button onClick to display a message box to the user asking them if they've printed this page/form yet. If they respond yes then go ahead and submit. If they respond no then I'd like the print dialog box to automatically open, or at least just keep the form active with the user-inserted dta still intact so they can print the page before submitting it. Thanks.
 
If the button is a DTC button, then add a onbeforeserverevent method (add a PageObject DTC first):

function thisPage_onbeforeserverevent(obj, evt) {
if (obj=="pbSubmit") {
if (confirm("Printed yet?") == false) {
thisPage.cancelEvent = true;
}
}
}

If your submit button is just plain HTML, then write a similar function that returns true or false

<input type=&quot;SUBMIT&quot; name=&quot;pbSubmit&quot; onclick=&quot;return confirm('Printed yet?');&quot;>

or

<input type=&quot;SUBMIT&quot; name=&quot;pbSubmit&quot; onclick=&quot;return checkPrinted();&quot;>

in javascript block...

function checkPrinted() {
//return false if NOT printed yet
// - prevents form from submitting.
return confirm(&quot;Printed yet?&quot;);
} (Content Management)
 
Thanks Merlin. The submit button is a DTC (btnSave) and i just placed this code you gave me on the page. I already had a page object DTC on the page. I changed your code to refer to the name of my button (btnSave right?) and the page still works just as if I never placed that code on the page. Bizzare. I thought I'd at least get an error or something. I'll play with it. Thanks again.
 
Never mind. VI inserted some extra JS code when I added the event handler that I just had to clean up. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top