Drupal: How to Prevent Duplicated Posts
In contrast to Drupal 6, Drupal 5 has no protection from multiple form processing. If a user clicks "Submit" button a few times, duplicated posts will appear.
Solutions
- Hide buttons once Submit button is clicked
Insert the following code to the end of page.tpl.php template:
$(document).ready(function() {
$(‘input[@type=submit]’).click(function() {
$(this).siblings(‘input[@type=submit]’).hide();
$(this).hide();
$(‘<p class="loading">OK…</p>’).insertAfter(this).slideDown(‘fast’);
})
})
How it works: when Submit button is clicked, all buttons disappears and a user couldn’t click them again.
- Use Form single module
Download&use this module to prevent duplicated posts: http://drupal.org/project/formsingle