Hi,

I expect that the browser is simply invoking a method on the HTML control that currently has the focus. If that HTML control happens to be a submit button then its default behaviour in that situation is to submit the associated form; if the control happens to be a text field then it will have a different effect. This isn't anything to do with JSF.

Daniel, are you saying that your proposal works when the user clicks in a text box then presses return, or that it allows the user to press return immediately after the page is rendered (but not after they select a text field or other control)?

Regards,

Simon

Daniel Young wrote:
I use the nasty “1-pixel image” hack, putting it first in the form so the action I want (“your.action”) is the default:

<h:commandButton action="#{your.action}" image="/images/blank.gif" type="button" tabindex="-1"/>

That should get you going for now, but if somebody does have A Better Way, I’d love to hear it…

------------------------------------------------------------------------

*From:* Mick Knutson [mailto:[EMAIL PROTECTED]
*Sent:* Tuesday, 5 December 2006 10:56 AM
*To:* MyFaces Discussion
*Subject:* ENTER key with a single form but multiple actions

I have a form with multiple actions and I want a default action to happen when I click the enter key.

Right now, I seem to get the 1st (default) action if I am NOT inside another component like a text field. But when I am inside another component, I get nothing submitted and have to manually mouse click the submit button.

Reply via email to