• Resolved abooster

    (@abooster)


    Hi, I wonder if you could add an animation to the forum’s submit button that (after clicking the button when submitting a new topic or reply) indicates to the user that it’s “working”?

    I mean, it can take quite a few seconds after clicking the submit button until *anything* happens. And some users (because they don’t see anything happening) click the submit button several times resulting is duplicate posts.

    So, ideally, after clicking the submit button the screen would dim out and a spinning wheel like http://spin.js.org would show up on the button or on the screen.

    That would make it clear to any user: It’s working, don’t click the submit button anymore.

    https://wordpress.org/plugins/bbp-style-pack/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Robin W

    (@robin-w)

    If I knew how I would !

    If you can find out how to do this and send me a link, I’ll add it to the code

    Thread Starter abooster

    (@abooster)

    I don’t really know but I googled a bit and found this:
    http://codepen.io/jmalatia/pen/HkmaA
    When you click one of those 2 blue buttons,
    that’s exactly the kind of thing that would tell the user:
    “Your post is being submitted…”

    Here’s another thing that might help:
    https://blog.oio.de/2010/11/08/how-to-create-a-loading-animation-spinner-using-jquery/

    What do you think?

    Plugin Author Robin W

    (@robin-w)

    ok, I spent quiet a while working this out, and many lines of code are reduced to just a few in the end!

    New version 3.1.7 contains the released version

    Several issues here

    1. bbpress submit is a php operation (server side) , but adding the spinner is a javascript (client side). Rewriting how this works would make bbpress submit incompatible with the many themes that re-work form submission, so I had to avoid that.

    2. Each type of browser (IE, Edge, Chrome, Firefox) handle form submission slightly differently. Several stop rendering the form as soon as the click button is clicked, and they consider this as a page reload, so don’t let the spinner get into action before they freeze.

    From what I have been able to test, Chrome always works, Firefox and IE mostly work – in that the spinner spins. Edge doesn’t seem to spin at all. However all as far as I can test put a minimum of a stationary spinner on the button, so you know that the submit is doing something.

    You activate this by going to

    Dashboard>settings>bbp style pack>Topic/Reply Form and activate item 5.

    Give it a try, and let me know how it works for you.

    Thread Starter abooster

    (@abooster)

    OK, for those browsers where only a stationary spinner shows up,
    wouldn’t it be possible to also put a text saying something like:
    “Your post is being submitted…”
    ??

    That text with “…” at the end is almost as good as a spinning wheel
    for indicating that it’s working and the user has to wait.

    Thread Starter abooster

    (@abooster)

    I mean, that text could appear for all browsers (that’s probably much easier to code).

    Plugin Author Robin W

    (@robin-w)

    Yes I did play with text, with very much your ideas in mind. But I can only add rather than replace, and that poses an issue because the plugin needs to cope with lots of languages.

    I did have a rather neat ‘ting…’ being added, which changes ‘submit’ to ‘submitting…’ which looks great but only in English !

    I’ve not given up working out how to do a better version, but after several very late nights kicking code around, I need to give it a short rest !

    If you are ok in editing files, you can go into
    wp-content/plugins/bbp-style-pack/js/bsp_enqueue_submit.js

    and change the lines 3 and 6 where it says

    $(this).append('<span class="bsp-spinner"></span>');

    to

    $(this).append('ting...<span class="bsp-spinner"></span>');

    you’ll need to change both lines 3 and 6

    Thread Starter abooster

    (@abooster)

    Aha, yes, I’ll add the “ting…”. Thanks for the tip!

    I didn’t think of the non-English options at all.
    Well, one way to solve the problem with non-English versions would be to let the owners add their own suffix (instead of “ting…”), something that works with their language.

    I also wonder if it’s possible to make a grey overlay appear over the button area?
    That overlay would cover the button, would contain a spinner and it should be pretty easy to customize the text on the overlay with any language.
    So, some sort of an overlay that is normally hidden but becomes unhidden when the submit button is pressed. Can this be done?

    Thread Starter abooster

    (@abooster)

    Well, I’ve just replaced those 2 lines with:
    $(this).append('ting your topic. Please wait...<span class="bsp-spinner"></span>');
    and
    $(this).append('ting your reply. Please wait...<span class="bsp-spinner"></span>');

    and that works perfectly for me. (“please wait…” jumps onto a second line in my case i.e. the button becomes bigger)
    No overlay really needed there.
    I think if you let the user customize that suffix, then users of any language can add the appropriate suffix in their language.

    Plugin Author Robin W

    (@robin-w)

    Great – glad that’s all working for you, and I’m still thinking of improving it, so was a great issue to raise.

    Choosing a suffix might work in some languages, but in others the word would change eg if it was ‘have’ and ‘having’ then adding an ‘ing’ wouldn’t work ! if some languages I suspect that the word changes.

    Plugin Author Robin W

    (@robin-w)

    @abooster

    I’ve just revised how this works, and updated to a new version 3.2.0.

    You will now find under the ‘topic/reply form’ tab the ability to set the message that appears after you click submit.

    This will then let you have your ‘Submitting your reply. Please wait…’ text

    Regards

    Robin

    Thread Starter abooster

    (@abooster)

    Finally managed to get it updated (I always need to manually apply a few custom bits first) and it works great!
    Thanks a lot!

    Thread Starter abooster

    (@abooster)

    P.S. Once I get the site up and running, I’m gonna send you a little donation. You’re doing a good job with your plugins, especially this one. (been working on my site for a while and now it’s almost ready to get started)

    Hello
    Very good idea and thank you for adding but it will not boot up at home, the spinner does not display view image => http://servertitis.free.fr/images/informatique/wordpress/no_spinner.jpg
    I have version bbp_style_pack 3.2.3 wordpress4.5.3 firefox:48.0.2
    website: http://www.sebr.fr/cpbvrc2
    Thank you

    Plugin Author Robin W

    (@robin-w)

    ok, when I tested the spinner presence did depend on server speed, and I could not guarantee that it will display, hence allowing a change of test to indicate that you had clicked.

    Try it in Chrome – that seemed to be the one that displayed consistently.

    That does not work either in Chrome, it has to come from my server I work on a NAS Synology DS216 + II . I would see this when the site will be on its final accommodation.
    Thank you

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Can you add a "working" animation to the submit button?’ is closed to new replies.