Can javascript do something at submit() time to dstract the user?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • charlie_M

    #1

    Can javascript do something at submit() time to dstract the user?

    Can javascript do something at submit() time to distract the user?...
    like clear the form... or clear the screen ??

    I have seen some fancy ways to prevent multiple clicks..... but a
    number of my cgi's eat up several seconds before they can respond and I
    would like to keep my user out of trouble;O)))

    Whatever it is. it has to be non-modal and not involve nph headers (my
    webserver does not support them).

    Are there any choices?

    TIA
    Chuck

  • VK

    #2
    Re: Can javascript do something at submit() time to dstract the user?

    you may try
    <input type="submit" value="Submit"
    onclick="event. cancelBubble=tr ue;return false;"
    onmouseup="if(t his.isAlreadyCl icked){doDistra ction();}
    else{this.isAlr eadyClicked=tru e;this.form.sub mit();}">

    Still all scriptable "blockers" are not very reliable if you have your
    script and your form on the same page. Form submission means that the
    current page doesn't exists anymore. I know you still see it, but
    officially nothing is here anymore: no button, no script. It may behave
    (or may not) untill the form responce arrival because some code is
    still retained in the program cash (orphaned scripts). You better
    update your CGI's: send first HTTP header to clear up browser window,
    then do your stuff with no rush and send the responce data.

    Comment

    • shlomi.schwartz@gmail.com

      #3
      Re: Can javascript do something at submit() time to dstract the user?

      Attach an onSubmit event to the form like so:
      <form onsubmit="retur n myFunction()">

      then do what ever you want at myFuction()

      Comment

      Working...