To prevent users accidentally posting multiple versions of a comment (for example if they press the "submit" button more than once) I would propose that we implement a "timelock" whereby users can't post more frequently than every 10 seconds. In other words, the workflow would go like this:

1. A user posts
2. That user can't post any more for another 10 seconds.

Jack.

Comments

Stefan Nagtegaal’s picture

Isn't that something where we need AJAX? After the submit button is clicked, the button should be disabled until after the form is processed..
IMO that is the way to go, or am I talking rubbish?

Crell’s picture

No, this doesn't require Ajax. Ajax involves server communication. There's no need to talk to the server in order to disable a button after it's been clicked. It could be done with some very simple Javascript, but Javascript != Ajax. Ajax is a technique for using Javascript to do certain things (server communication).

However, a critical requirement of Drupal is that Drupal Core work without Javascript enabled. An all-Javascript solution would have to ensure that nothing breaks if JS is diabled.

There's also cases where you don't want the button disabled. I've worked with web apps where one in fifty times, when you click a button the connection just hangs for a while. If the button was just disabled, then you can't click it again! If it only disabled for a second or so to avoid accidental double click, that might work.

Powers that Be: Would that be acceptable vis a vis the no-required-Javascript rule?

dan_aka_jack’s picture

Hi,

Thanks loads for your very swift replies.

An alternative to using client-side cleverness would be to do it all server-side. e.g. every time a comment is submitted, comment.module checks when the user last submitted a comment. If (new_comment_timestamp < old_comment_timestamp + 10 seconds) then comment.module refuses to enter the new comment into the database and gives the user helpful error like "The administrator has setup this website so that users have to wait 10 seconds before posting again, this isn't to annoy you, we promise. It's to prevent accidental repeat posting".

chx’s picture

Status: Active » Closed (won't fix)

Use form API to do this. No way this goes into core.

dan_aka_jack’s picture

May I ask why you think this shouldn't go into core? Multiple posts are one of the biggest problems on my two drupal-powered forums.

I'll even write the patch if no one else wants to.

dan_aka_jack’s picture

This idea can't be completely insane... v.Bulliten prevents users from submitting posts more frequently than every 30 seconds by standard, I believe.

chx’s picture

Status: Closed (won't fix) » Active

*shrug* i just think this does not belong to core, but... let's see what happens after you have written the patch. you have a nice amount of questions to answer, like would you protect nodes and comments w/ the same time, where to put the setting, you need to provide a permission to skip it...

dan_aka_jack’s picture

Cool, thanks. I'll try to get the patch written this Saturday.

If anyone has any suggestions about this feature request then please fire away.

markus_petrux’s picture

Isn't it a bit redundant when "preview" is forced? I mean that feature may also prevent from double posting. But anyway, maybe both methods can co-exist... not sure... :-/

dan_aka_jack’s picture

Good point...

...but we've got preview enforced on http://ukfilm.org/forum and we still get problems with multiple posts. Once the user has previewed their comment they have to "submit" and they can (and do) press the submit button several times if the site's being slow. I don't think "enforced preview" is an effective protection against multiple posting.

markus_petrux’s picture

True

mudanoman’s picture

Any word on the time limit between posts?

arnabdotorg’s picture

You can implement this as a "challenge" in the captcha module : write a new captcha challenge that is successful if the timestamp of the form last posted is n seconds before the current timestamp. That's all.

LAsan’s picture

Version: x.y.z » 7.x-dev

dan_aka_jack: still want to create the patch?

rszrama’s picture

Status: Active » Closed (won't fix)

This has laid dormant for a while and I also agree with chx that it isn't a core worthy feature, esp. without considering protecting any forms that could benefit from double entry protection or laying out what/where settings would go. Since the only person who seemed interested in making a patch didn't get it done in 2006, I'm gonna "won't fix" this until someone re-opens it with "patch needs review." ; )

hanno’s picture

Status: Closed (won't fix) » Closed (duplicate)