Save form on Enter

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
JoshK131
Posts: 6
Joined: Tue Jan 26, 2021 11:09 pm

Save form on Enter

Post by JoshK131 »

Hello,

In a form that gets displayed in a new tab the default save button is set and with a process that runs after save, and "close form on save" is not selected.

When the user presses [ENTER] the form should save so the process can run.

Using javascript seemed like a possible way to do it so the below js script was attempted in the initialization script of the form.
The id of the save button was set to "calculate".

Code: Select all

$(this).on('keypress', function(event) {
console.log("qwe");
    if (event.keyCode === 13) {
        event.preventDefault();
        $( "#calculate" ).trigger( "click" );
    }
});
How can this problem be solved?


Aware IM Build 2832
Jaymer
Posts: 1889
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Save form on Enter

Post by Jaymer »

Well, its debatable if/or not a Form in a Tab SHOULD "do something" when the user presses <Enter> on a data field

You may not know that if you want this behavior, thats how a Popup window works - and that might solve your issue.
Problem with that is Combo Boxes - because if a user, when arriving on a combo, types some data, arrows to a selection AND THEN presses Enter (thinking he is selecting that option), the Form wants to close (cause its a popup and thats what they do)

In either case, the user can tab into the [Save] button - and use the keyboard. I press a <space> because there once was a Kendo bug where you pushed <enter> on the save button and TWO events went to Aware and the record was saved/created TWICE.

But I don't know how to do what you ask.
J
Click Here to see a collection of my tips & hacks on this forum? Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
aware_support
Posts: 7247
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: Save form on Enter

Post by aware_support »

Try using CTRL/ENTER to save the form
Aware IM Support Team
Jaymer
Posts: 1889
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Save form on Enter

Post by Jaymer »

That works for me. Fooled me at first. Doesn't work unless the cursor is parked on a field (which is fine).
Thats a great shortcut!
Click Here to see a collection of my tips & hacks on this forum? Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
JoshK131
Posts: 6
Joined: Tue Jan 26, 2021 11:09 pm

Re: Save form on Enter

Post by JoshK131 »

Amazing! Thank you very much
Post Reply