Skip to:
Content
Pages
Categories
Search
Top
Bottom

Unable to disable double-click on “Post Update”.


  • hidalgoantonio
    Participant

    @hidalgoantonio

    Hello,

    I’ve been testing different ways to disable the “Post Update” button under the Profile/Activity page after it has been clicked once. This is for situations where someone is impatient and clicks that button multiple-times, which would result in several re-posts of the same text.

    I can’t seriously be the first one with this question. Anything that can factually resolve this problem?

    I’ve tried this: https://wordpress.org/support/topic/how-to-prevent-double-form-submission First suggestions didn’t work. Second method, makes the “Post Update” button disappear entirely unless the page is refreshed by the user.

    This didn’t work either:

    jQuery('input:submit').click(function(){
    jQuery('input:submit').attr("disabled", true);
    });

    Taken from: https://buddypress.org/support/topic/disabling-submit-button-after-clicking-to-avoid-multiple-posts/

    I am at my wits’ end on this. I’d absolutely appreciate any help with it. Thanks!

    • WP: 4.5.3
    • BP: 2.6.1.1
    • Theme: Spacious (child theme); Reproduced the issue in Twenty Fifteen
    • Site not accessible to the public yet.
    • PHP 5.5.37

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

  • danbp
    Participant

    @danbp

    Hi,

    despite it is not a BuddyPress issue, but a common coding task, here is what i would try to apply (or try to use) your place.

    The button ID can be found in bp-legacy/buddypress/activity/post-form.php

    Nothing to do with previous, your php version is no more maintained since 10th july 2016. Consider updating to 5.6 or 7.0


    hidalgoantonio
    Participant

    @hidalgoantonio

    Hi. Thanks for your response.

    Unfortunately, the issue is still ongoing. I’ve tried simple javascript, invoking jQuery functions, etc.

    It looks like some triggers are being applied from separate scripts.

    I’ve installed BuddyPress without modifying anything from the core in two separate websites and the issue is being reproduced in both.

    I’ll continue researching; if I figure it out, I’ll post the solution here.

    Thanks again.


    hidalgoantonio
    Participant

    @hidalgoantonio

    Hi!

    Found the culprit!

    Like you said, it wasn’t Buddypress at all. It was the rtMedia plugin’s js file called “rtMedia.backbone.js” that had the on click function set to “false” for some reason. I changed that to “true” in row 756, and deleted this from rows 717-723:

    //handling the "post update: button on activity page
    	jQuery( '#aw-whats-new-submit' ).removeAttr( 'disabled' );
    	jQuery( document ).on( "blur", '#whats-new', function () {
    		setTimeout( function () {
    			jQuery( '#aw-whats-new-submit' ).removeAttr( 'disabled' );
    		}, 100 );
    	} );

    Just documenting this here in case other folks find their way to this through search engines.

    Cheers!

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