The <b:defaultCommand>
controls which button fires the click event when the enter key is pressed.
The default command lets you specify which command has to be fired, using the target
attribute set to the command id.
Since BootsFaces 1.4.2, the <b:defaultCommand />
also works with
<b:commandButtons>>
bearing a col-*
or span
attribute. Kudos go to GitHub user
geopossachs who kindly contributed this improvement.
The <b:defaultCommand>
component activates the click listener on the closest form of the component.
This way, you can define multiple defaultCommands in different form scopes.
Note that each form can support only a single defaultCommand. You have to split your page into several forms in order to add multiple defaultCommands. Also note that defaultCommands only apply to the surrounding form. Defining a default command in a form doesn't add a defaultCommand to any other form on the page.
First Form (focus on input text and press enter key)
Second Form (focus on input text and press enter key)
Default commands allow you to use search expressions. In many cases this allows you to get rid of the ids.
Attribute | Default value | Description |
---|---|---|
id | (none) | Unique identifier of the component in a namingContainer. |
rendered | false | Boolean value to specify the rendering of the component, when set to false the component will not be rendered. |
target | (none) | Id of the default command for container div. |