Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

Hitting enter submits the form as if the first BWF button is clicked

David Hyland's Avatar

David Hyland

04 Aug, 2014 08:47 PM

Hitting Enter while the cursor is in a text field on a publish page submits the page. This in itself is not a shocker however on a channel that's controlled by BWF the submit button that is triggered is the first button that appears in the HTML (or the last BWF button that shows on the page given that they're floated right).

So for a new entry hitting enter submits the form and sets the entry as LIVE:
<button value="open" name="epBwfEntry_update_open" class="submit bwf_save_button" type="submit">Publish</button>

If I then edit that same new entry and hit enter again the form is published again but this time is set as CLOSED:
<button value="closed" name="epBwfEntry_update_closed" class="bwf_blue_button" type="submit">Archive</button>

And so it goes on ...

Is there a way to disable the enter button (although not sure that's a good idea usability wise?) or another solution to prevent this from happening?

Any ideas greatly appreciated!

  1. Support Staff 1 Posted by Malcolm Elswort... on 05 Aug, 2014 01:46 PM

    Malcolm Elsworth's Avatar

    Hi David,

    I can see this is a potential issue. Disabling the enter button from submitting the form would be one way of addressing it but as you say, this might have undesired side effects.

    Can you leave this one with us for now? We'll give it some thought.

    Thanks,
    Malcolm

  2. 2 Posted by David Hyland on 05 Aug, 2014 02:14 PM

    David Hyland's Avatar

    FYI, I've temporarily sorted it by adding to your buttons-ui.js:

         /*
         * Prepares the EE entry edit DOM for injecting Better Workflow UI
    elements.
         * returns nothing.
         */
         _prepareDom: function () {
             this._hideStatusSelectInput();
             this._removeDefaultSubmit();
             this._insertButtonContainer();
             this._disableEnterSubmit(); // #CUSTOM#
         },

         // #CUSTOM#
         /*
         * Disables enter button on submit
         */
         _disableEnterSubmit: function () {
             $('#publishForm input').keypress(function(e) {
               var code = e.keyCode || e.which;
               if (code == 13) {
                 e.preventDefault();
                 return false;
               }
             });
         },

  3. 3 Posted by David Hyland on 05 Aug, 2014 03:05 PM

    David Hyland's Avatar

    Hey Malcolm

    No problems. I might disable the enter button for the time being as the
    client is moaning about it.

    I'll await an update.

    Cheers

    David

  4. Malcolm Elsworth closed this discussion on 08 May, 2015 09:31 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac