bbPress

Simple, Fast, Elegant

bbPress support forums » Troubleshooting

Double Posts

(4 posts)
  • Started 1 month ago by edwinfoo
  • Latest reply from bharatk
  • This topic is not resolved
  1. edwinfoo
    Member

    When a post creator hits "Send Post" and if there is a unexpectedly slow response because of a temporary stall, slow pipe or outage and they click on "Send Post" a second time......viola.....double post.

    Is there an easy fix to prevent the double post from occurring?

    Posted 1 month ago #
  2. You know, there was a post here a year or more ago about using javascript to prevent duplicate form submissions, but I can't find it right now. I did find some results with google though, just not at this site.

    http://www.google.com/search?q=prevent+duplicate+form+submission+javascript

    The solution posted here at bbpress.org was similar to this one (at the end):
    http://www.ahfb2000.com/webmaster_help_desk/showpost.php?s=95582078bfca56f52bafd97c9de84643&p=12854&postcount=2

    Posted 1 month ago #
  3. Hi,

    I'm using 1.0 alpha 2 and had the same issue and used this to disable the the button and change it's label/value after submission.

    On the edit form, replace:

    <input type="submit" id="postformsub" name="Submit" value="<?php echo attribute_escape( __('Post Message') ); ?>" tabindex="4" />

    with

    <input type=hidden id=hidden1><input type="submit" id="postformsub" onclick="this.disabled=true;hidden1.name=this.name;hidden1.value=this.value;this.value='Please Wait...';this.form.submit();" name="Submit" value="<?php echo attribute_escape( __('Post Message') ); ?>" tabindex="4">

    This creates a hidden form field which the submit buttonvalues are passed to before it's disabled, as when it's disbaled it won;t work as a submit button.

    I hope that helps.

    I similar thing can created on on the edit form.

    Bharat

    Posted 1 month ago #
  4. the WITH replace code does not seem to appear corectly - I think because it had not spaces. here it is again:

    <input type=hidden id=hidden1><input type="submit" id="postformsub" onclick="this.disabled=true; hidden1.name=this.name; hidden1.value=this.value; this.value='Please Wait...'; this.form.submit();" name="Submit" value="<?php echo attribute_escape( __('Post Message') ); ?>" tabindex="4">

    Posted 1 month ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.