Trigger main command when pressing enter in form (#4102)

* Triggers main command when pressing enter in form

Adds hidden button that triggers main command when pressing the enter key

* Lint

Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
Marc Bernard 2020-11-05 03:46:21 -05:00 committed by GitHub
parent b408cad115
commit 5c1298697d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -285,6 +285,14 @@ CLASS ZCL_ABAPGIT_HTML_FORM IMPLEMENTATION.
ri_html->add( |<div class="{ iv_form_class }">| ).
ri_html->add( |<form method="post"{ ls_form_id }>| ).
" Add hidden button that triggers main command when pressing enter
LOOP AT mt_commands ASSIGNING <ls_cmd> WHERE is_main = abap_true.
ri_html->add( |<button type="submit" formaction="sapevent:{ <ls_cmd>-action
}" class="hidden-submit" aria-hidden="true" tabindex="-1"></button>| ).
EXIT.
ENDLOOP.
ri_html->add( |<ul>| ).
LOOP AT mt_fields ASSIGNING <ls_field>.