http://qs321.pair.com?node_id=1185885

Disabling submit buttons on click is pretty common nowadays I think, adding the following to the Free Nodelet Settings enables this behavior for the "preview" and "create" buttons (using jQuery). Because disabled buttons don't get included in form submissions, but PerlMonks relies on them, I added a workaround which adds a <input type="hidden" ...>.

<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> <script language="javascript" type="text/javascript"> //<!-- $(document).ready(function() { $("input[type='submit'][name='op'][value='preview'], " +"input[type='submit'][name='op'][value='create']") .click(function() { $(this).prop("disabled",true); $(this).after( $('<input>').attr({ type: 'hidden', name: $(this).attr('name'), value: $(this).attr('value') }) ); }); }); //--> </script>

Replies are listed 'Best First'.
Re: [Free Nodelet Hack] Disable Submit Button on Click
by LanX (Saint) on Mar 25, 2017 at 14:22 UTC
    > Disabling submit buttons on click is pretty common nowadays

    OK, but what for? :)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      OK, but what for? :)

      Preventing double form submissions - I was inspired by Double posting, although now (after the updates) it sounds like that is a different problem.

        I'm pretty sure that clicking [create] again before the last submit finished doesn't cause harm.

        Will test it here ...

        Oops ... nope I can't test reliably because of my own wiki nodelet hack.

        Anyone? :)

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

        I'm pretty sure that clicking [create] again before the last submit finished doesn't cause harm.

        Will test it here ...

        Oops ... nope I can't test reliably because of my own wiki nodelet hack.

        Anyone? :)

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

        I'm pretty sure that clicking [create] again before the last submit finished doesn't cause harm.

        Will test it here ...

        Oops ... nope I can't test reliably because of my own wiki nodelet hack.

        Anyone? :)

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Re: [Free Nodelet Hack] Disable Submit Button on Click
by LanX (Saint) on Mar 25, 2017 at 15:55 UTC
    This might prove useful if the button stays disabled after going back in history.

    Like this people might be stopped from accidentally posting mutants ( ie edited clones which are mostly duplicates)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!