How to submit 2 different forms in a view both by ENTER key?

Hi,

I have 2 different forms in a view. Each form contains several textfields.
How can I submit/commit each form if ENTER key is pressed within a textfield?

I know I can create a ShortcutListener and attach it to each textfield, BUT then I cannot have different commit actions for the forms? I only want the first form to be submitted for enter key within the first-form-fields, and only the second form for the second-form-fields.

If I attach different ShortcutListener to the fields, though only the first-form action is triggered if I hit the enter key in the second-form.

Why? And how can I overcome this?

If the forms are in separate panels (they can be “light” so they don’t visually affect the UI), you could attach the ShortCutListener(s) to the panels themselves.

See
Keyboard Shortcuts
on the sample for an example. (You can pretty much “hide” the panels via CSS/addStyleName(“light”)

Thanks, this is what I was looking for.