Connecting Tech Pros Worldwide Help | Site Map

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

charlie_M
Guest
 
Posts: n/a
#1: Jul 23 '05
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
Guest
 
Posts: n/a
#2: Jul 23 '05

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


you may try
<input type="submit" value="Submit"
onclick="event.cancelBubble=true;return false;"
onmouseup="if(this.isAlreadyClicked){doDistraction ();}
else{this.isAlreadyClicked=true;this.form.submit() ;}">

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.

shlomi.schwartz@gmail.com
Guest
 
Posts: n/a
#3: Jul 23 '05

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


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

then do what ever you want at myFuction()

Closed Thread