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?
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.
Here is the JS I was thinking of. It would be added to the submit button input element:
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.
Chris, lovely code, works straight away. 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
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.)
It also works quite nicely using:
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?
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.
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.
Chris, really? What browser?
The page really shouldn’t hang just because of
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.
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.
Hmm okay, fair enough. I’ll have a look at that myself. Thanks – would’ve been incredibly annoying if that stopped people posting!
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.
- You must be logged in to reply to this topic.