Closed Thread Icon

Topic awaiting preservation: Submit protection (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12201" title="Pages that link to Topic awaiting preservation: Submit protection (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Submit protection <span class="small">(Page 1 of 1)</span>\

 
Rane
Bipolar (III) Inmate

From: Denmark
Insane since: Oct 2001

posted posted 05-02-2002 13:39

Afternoon

I dont know if this belongs here or in the dhtml/javascript - but here goes.

Im making a shoutbox/tagwall/minichat and I want to prevent user from spamming the wall by speedclicking multiple times on the submit button. Therefore I need some kinda script that can start a "timer" after the user submits the form the first time (for example a 5 sec waiting period) - so he HAS to wait 5 seconds before he can submit the next batch of text.

How can that be done? (sorry if this should belong in the dhtml section, but i figure i gotta use the users Session variabel or something?)

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 05-02-2002 14:02

Rane: If it is only a 5 second wait then its probably something like JavaScript you are looking for. I think it was the Doc who dropped this script in when the subject was raised:

code:
<script language="javascript">
<!--
var submitcount = 0;

function submitOnce() {
if (submitcount == 0) {
submitcount++;
return true;
}
return false;
}
//-->
</script>



It is useful not just to stop spammers but to prevent ordinary users from clicking the button multiple times if things don't respond quick enough. You could always set a cookie as well if you wanted.

Emps

Rane
Bipolar (III) Inmate

From: Denmark
Insane since: Oct 2001

posted posted 05-02-2002 14:15

Alrighty, thanks a lot Emps

hlaford
Bipolar (III) Inmate

From: USA! USA! USA!
Insane since: Oct 2001

posted posted 05-02-2002 16:04

button.onsubmit = function(){return false;}
window.setTimeout('button.onsubmit = null;', 5000);

you may need to muck with the syntax, but the idea is there.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 05-02-2002 18:22

Remember too unless you are using some sort of frameset or fancy DHTML form submission then the user is going to be redirected to another page that processes the cgi. So really you can just use doc's script instead of waiting the 5 seconds. (which will disable the submit as soon as it's hit while the user gets processes via cgi



.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

« BackwardsOnwards »

Show Forum Drop Down Menu