Enter Key Behaviour

Hello, when we hit Enter (on the keyboard) our app page goes back to the home page. Is there any way we can control what hitting Enter does? Thanks and have a great new year everyone.

Hi Darius, welcome to the community!

On any web page (including a Liberty Create page) pressing enter whilst filling in a form will perform the actions of the first “Submit” button on the page - unless you do something about it. In this case going back to the home page is what the first submit button is doing. There are three ways I can think of immediately that can change this behaviour. The first two are “out of the box” but will always save the record you are working on.

  1. Alter the order of the buttons on the page (assuming more than one) so the first button that appears performs the action you want to happen when enter is pressed.

  2. Add another submit button to the page performing the required action (Independant settings and Destination = none or “This Page” would leave you on the current page) - and set its presenter to “Hidden Row” so it is not visible on the page. Place it as the first submit button on the form.

The third option would involve coding up a widget or something, which attaches a “keydown” event handler for every input field, and if the key is an enter key, tab to the next field and ignore it.

I have written the widget and will get it documented and uploaded to the community tomorrow.

Richard

2 Likes

Thanks Richard. Works like a charm :slight_smile: