!! submit button clicked !! is it that hard???

Results 1 to 2 of 2

Thread: !! submit button clicked !! is it that hard???

  1. #1
    Join Date
    Dec 1969

    Default !! submit button clicked !! is it that hard???

    How can I know if a submit button has been clicked?<BR>I have an ASP page which contain a form. I want to know ( from the Onbeforeunload event ) if the page is unload from the submit button or not. <BR>In case of not, I would like to send a notification msg "quit without save? ... bla bla "<BR><BR>Thanks a lot

  2. #2
    Join Date
    Dec 1969

    Default Very easy...

    I hope you are aware the OnBeforeUnload only works in MSIE browsers.<BR><BR>But anyway...<BR><BR>*******************************<B R><BR>&#060;SCRIPT&#062;<BR>var submitted = false;<BR><BR>function validate( frm )<BR>{<BR> // do any needed validation...<BR> ....<BR> // if all validation passes, then at end of this function:<BR> //<BR> submitted = true;<BR> return true;<BR>}<BR><BR>function submitCheck( )<BR>{<BR> if ( submitted ) return true; // leaving becuz of submit!<BR> // oops...check to be sure?<BR> return confirm("You have not yet submitted the form.
    "<BR> + "Are you sure you want to quit anyway?" );<BR>}<BR>&#060;/SCRIPT&#062;<BR><BR>&#060;BODY onBeforeUnload="return submitCheck( );"&#062;<BR><BR>&#060;FORM ... onSubmit="return validate( this );"&#062;<BR>...<BR>&#060;/FORM&#062;<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts