defaultAction

Table of Contents

Overview

Since 3.3

You can use the icecore:defaultAction tag to initiate a form submit when a certain key is pressed. An action or an action listener can be defined to control which method to be invoked on the server side.

See the ICEfaces Showcase Live Demo of this component, complete with source code.

Getting Started

To use the icecore:defaultAction tag, first declare the core namespace:

<html ... xmlns:icecore="http://www.icefaces.org/icefaces/core">

Then add the tag to your page markup wiring the action to the bean method:

<h:form id="form"> 
    ... 
    <icecore:defaultAction actionListener="#{sampleBean.update}" key="Enter"/>     
    ... 
</h:form>

The component can be used within a form to capture certain key press events. Multiple icecore:defaultAction instances can be used to capture different key press events.

<h:form id="form"> 
    ... 
    <icecore:defaultAction actionListener="#{sampleBean.update}" key="Enter"/> 
    <icecore:defaultAction action="#{sampleBean.cancel}" key="Esc"/> 
    <icecore:defaultAction action="#{helpBean.help}" key="F1"/> 
    ... 
</h:form>

Multiple key mappings wired to the same action/actionListener can be done as well.

<h:form id="form"> 
    ... 
    <icecore:defaultAction actionListener="#{sampleBean.update}" key="Enter"/> 
    <icecore:defaultAction actionListener="#{sampleBean.update}" key="Esc"/> 
    <icecore:defaultAction actionListener="#{sampleBean.update}" key="LeftArrow"/> 
    ...
</h:form>

Attributes

TagLib Documentation
This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available here.

key Use this attribute to specify the key-press that should be used for triggering the submit. The following predefined key names can be used: "Enter", "Esc", "Space", "PageUp", "PageDown", "PageUp", "LeftArrow", "UpArrow", "RightArrow", "DownArrow", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12".

action Use this attribute to reference a bean method. The method is invoked when the defined key is pressed and no other component within the form doesn't capture the fired event.

actionListener Use this attribute to reference a bean method. The method is invoked when the defined key is pressed and no other component within the form doesn't capture the fired event.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2018 ICEsoft Technologies Canada Corp.