I just noticed some very strange behavior (using IE) regarding buttons:
If I have a single <h:inputText> field and a single <h:commandButton>,
then hitting enter seems to invoke something (because the window
flickers), but the commandButton's action does not get fired.
However, if a add a second <h:inputText> field, even if it has no
associated action, then, if I enter something in the first <h:inputText>
field and hit enter, the <h:commandButton>'s action gets fired.
One (or zero) entry box ==> hitting enter doesn't do anything
two entry boxes (or a table of check boxes) ==> hitting enter
causes the command button's action to fire
This is certainly strange. Just to make sure, I did the following:
Created a screen with just a textArea and a commandButton ==>
hitting enter didn't do anything
Then added an empty inputText ==> hitting enter didn't do
Then added another empty inputText ==> hitting enter fired the
Does anyone else notice this behavior?
From: Travis Reeder [mailto:treeder@...]
Sent: Wednesday, September 28, 2005 11:30 AM
To: MyFaces Discussion
Subject: Re: Having a "Default" commandButton
On 9/28/05, CONNER, BRENDAN (SBCSI) <bc1378@...> wrote:
> Is there a way to specify one's <h:commandButton> so it is the
> button? In other words, is there a way to specify it such that it is
> clicked when the user hits the "enter" key?
> Also, on a related note, is there a way to specify an <h:inputText>
> that the cursor gets placed there automatically when the page loads,
> rather than requiring the user to first click on the text box before
> - Brendan