A lot of developers search for a property in the <af:commandButton> to specify that pressing ENTER should activate the button.
As they don't find any they conclude this is not possible to define it in ADF Faces.
This is true you cannot specify it at the <af:commandButton> level (you can only define an access key there), but you can in the <af:form>.tag.
More details below.
There is a property accessKey (sometimes referred to as the "mnemonic") to specify the character that, when pressed in combination with the ALT key, will activate this commandButton.
The button is rendered with the accessKey underlined as shown the next figure:
NB: you can also use the textAndAccessKey to simultaneously set both the "text" and "accessKey" attributes from a single value, using conventional ampersand (' & ') notation.
attribute of the command button whose action would be invoked by
default for form submit on hitting ENTER on any of the input fields of
the form:
By default, JDeveloper creates a JSF standard h:form tag in your JSF pages, but you can easily convert it to an af:form tag by performing the following steps:
As they don't find any they conclude this is not possible to define it in ADF Faces.
This is true you cannot specify it at the <af:commandButton> level (you can only define an access key there), but you can in the <af:form>.tag.
More details below.
af:commandButton
There is no property in the <af:commandButton> tag to specify that pressing the ENTER key is the equivalent of clicking the commandButton.There is a property accessKey (sometimes referred to as the "mnemonic") to specify the character that, when pressed in combination with the ALT key, will activate this commandButton.
<af:commandButton text="Login"In this example, pressing ALT + L will activate the Login button.
id="loginButton"
(...)
accessKey="L" />
The button is rendered with the accessKey underlined as shown the next figure:
NB: you can also use the textAndAccessKey to simultaneously set both the "text" and "accessKey" attributes from a single value, using conventional ampersand (' & ') notation.
af:form
You can specify it in the <af:form> tag. It contains a property defaultCommand where you can specify the idattribute of the command button whose action would be invoked by
default for form submit on hitting ENTER on any of the input fields of
the form:
<af:form (...) defaultCommand="loginButton" >
(...)
</af:form>
By default, JDeveloper creates a JSF standard h:form tag in your JSF pages, but you can easily convert it to an af:form tag by performing the following steps:
- in the Structure window, select h:form
- select the right-click menu Convert
- in the Convert Form dialog, select the category "ADF Faces Core";
select the item to be created: Form and click OK - select af:form in the Structure window (that's the component we have created);
in the Property Inspector, type the id of the commandButton in the property DefaultCommand, in this example loginButton