Skip to:
Content
Pages
Categories
Search
Top
Bottom

Duplicate Posts


  • Michael Nolan
    Member

    @mikenolan

    I’m getting occasional duplicate posts on bbPress. I’m guessing part of it might be users clicking the submit button twice but I wondered whether this is a problem for anyone else?

Viewing 10 replies - 1 through 10 (of 10 total)

  • chrishajer
    Participant

    @chrishajer

    It happens for me if people don’t wait for their post to appear. My server has a response time of about 8 seconds (i.e. the “Posted xx seconds ago” at the bottom of the post, always shows 8 there, where on this site, bbpress.org normally shows 0 seconds ago.) So, yes, that does happen, but not enough that I worry about it. It is from people hitting submit twice.

    I read about a javascript solution once, but I never looked into it.


    chrishajer
    Participant

    @chrishajer

    Here is the JS I was thinking of. It would be added to the submit button input element:

    onclick="this.style.display='none';"

    I have no idea if that will work :) I just read it on the Internet. There are lots of hits in Google if you’re curious. In my experience, once people do it a few times, they realize it just takes a couple seconds to appear, so they become more patient and avoid double posting.


    fel64
    Member

    @fel64

    Chris, lovely code, works straight away. :D Implemented in my forum, the button instantly disappears and double-posting is impossible. Thanks a lot!

    If anyone else wants to implement this but is unsure how, go to your theme (or Kakumei?) and open post-form.php using Notepad.

    Find the line that says:

    <input type=”submit” id=”postformsub” name=”Submit” value=”<?php echo attribute_escape( __(‘Send Post »’) ); ?>” tabindex=”4″ />

    and change it to

    <input type=”submit” id=”postformsub” name=”Submit” value=”<?php echo attribute_escape( __(‘Send Post »’) ); ?>” tabindex=”4″ onclick=”this.style.display=’none’;” />

    (Could someone please add the overflow: auto property for posts in this theme’s CSS? It’s incredibly inconvenient for code running over several lines.)


    Michael Nolan
    Member

    @mikenolan

    It also works quite nicely using:

    onclick="this.disabled=true"

    But I can’t get it to re-enable on pressing back – when there is no message for instance. I’ve tried onload="$('postformsub').disabled=false" in the body (we’re using Prototype) but it doesn’t seem to do anything. Is there another event that I’m forgetting that is called when the page is reloaded via the back button?


    chrishajer
    Participant

    @chrishajer

    Hmm, I actually tried both of these today and my members were unable to post. The page just hung. I was using 1.0 alpha. Not sure what was going on there, but I removed this piece of code. I would rather deal with duplicate posts than a broken forum.


    Michael Nolan
    Member

    @mikenolan

    I actually had to remove the code I put in because it didn’t work properly with Safari. I’ve also just had to deal with the duplicates.


    fel64
    Member

    @fel64

    Chris, really? What browser?

    The page really shouldn’t hang just because of

    onclick="this.style.display='none';"

    I’m also using 1.0-alpha, and I have no problems. Taking out the JS solved the problem?!

    That should be such standard JS code I’m surprised it doesn’t work in Safari. I’ll have to test it.


    chrishajer
    Participant

    @chrishajer

    I don’t really know what browsers. It worked for me with FF2, but my members are mostly using IE 6 and 7. So, not sure what the deal was there. Sorry I don’t have better data. Once the emails started, I just took that out and everything was OK. No other changes were made.


    fel64
    Member

    @fel64

    Hmm okay, fair enough. I’ll have a look at that myself. Thanks – would’ve been incredibly annoying if that stopped people posting! :P


    Michael Nolan
    Member

    @mikenolan

    I didn’t test the Safari problem myself but got the report from one of our key users so rather than go back and forward trying to track the problem down I just reverted the change.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Skip to toolbar