Record unintentionally created by hitting [Enter]

Record unintentionally created by hitting [Enter]

Hi all,

In the create/edit mode I was adding a record and just to would like to go to the next line/field within the record I punched [Enter]. That punch created instantly the record.
When I tried to edit the record, it just added a new record instead of editing the existing record.
FYI: The create/edit page had been created 'automatically' by outsystems.

Does anyone know how the [Enter] button can be ignored for creating a record, but is just being used as going to the next line/field?
Does anyone know what to do to just edit the record instead of adding a new one?
Arnold -

That is because the "Save" button has "Is Default" set to True. That means that the Enter button submits the form. Even if that WASN'T the case, your Web browser is likely to treat the first button on the form as a "Submit" button to be used when you press Enter. Using Enter to go to the next line/field is a habit from the native application days, but with the Web browsers' treatment of Enter being what it is, it's not the way things are done any more, for better or for worse. :(

But don't dispair! There is hope.

The trick is to make an INVISIBLE button, and set "Is Default" to True, and wire that invisible button to do nothing. For that, set its Destination to an External URL, and use "javascript:void(0);" as the destination (making it do nothing). To make it invisible, do NOT set "Is Visible" to false, that will cause the button to not be sent at all as HTML. Instead, set an external property of "style" equal to "display: none;".

Now, if you want to do something even fancier, you can. You'll need to add some jQuery onto the page that will hook onto the input field, capture the keypress event, and if the event's keycode property is 13 ("Enter"), then do something else (like set focus on the next field on the screen). That's a bit more work, of course.