CheckboxButton

compared with
Current by Arturo Zambrano
on May 08, 2018 15:20.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 17 changes. View first change.

 h3. Overview
  h2. Overview
 _Since 2.0_
  
The _ace:checkboxButton_ component is a simple true/false selection used to toggle a value that is bound to the button. When _singleSubmit="true"_ the value will be submitted to the server. When _singleSubmit="false"_, the value is maintained by the client until some other component submits the form the _checkboxButton_ occurs in.
  The _ace:checkboxButton_ component is a simple true/false selection used to toggle a value that is bound to the button. As of EE 3.3.0_P02/4.0 release, the buttonGroup component can be used to manage a group of checkboxButton components.
  
NOTE that rendering with _class="ice-skin-sam"_ renders this component as a checkbutton (use label attr with _labelPosition="on"_)
 with _class="ice-skin-rime"_ it is rendered as a checked box (use _labelPosition="left"_)
  {tip}See the ICEfaces Showcase [Live Demo|http://icefaces-showcase.icesoft.org/showcase.jsf?grp=aceMenu&exp=checkboxButton] of this component, complete with source code.{tip}
  
h3. Usage
 {code}
   
 h2. Getting Started
 {panel}
 {code:xml|borderStyle=dashed}
 <html ... xmlns:ace="http://www.icefaces.org/icefaces/components">
<!-- can use either ice-skin-sam or ice-skin-rime -->
 <h:body class="ice-skin-rime">
  <h:body>
  <h:form>
  <ace:checkboxButton
value="{button.checkedRime}"
  labelPosition="left"
  label="checkedRime"
  singleSubmit="true"/>
   value="#{button.checked}"
  label="checkbox"/>
  </h:form>
 </h:body>
 </html>
 {code}
{code}
 <h:panelGroup styleClass="ice-skin-sam">
  <ace:checkboxButton
  value="#{button.checkedSam}"
  label="checkedSam"
         labelPosition="on"
  singleSubmit="false"/>
 </h:panelGroup>
 {code}
  {panel}
 h2. Attributes
  
h3. Attributes
  
 {info:title=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|http://www.icefaces.org/docs/v2_latest/ace/tld/ace/checkboxButton.html].{info}
  {tip:title=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|http://www.icefaces.org/docs/v4_latest/ace/tld/ace/checkboxButton.html].{tip}
 {panel}
*value* the value binding (bean) tied to the value of the checkboxButton-usually to a backing bean through el.
 {panel}
 {panel}
 *label* The label of the button-what the user sees that relates to that particular button. For example, "Remember Me"
 {panel}
 {panel}
*labelPosition* position of the label. For ice-skin-sam, the label is placed directly on the button itself so labelPosition is "on". For ice-skin-rime, the label is placed to the left of the button, so labelPosition="left"
  *style* a pass through to the root element of the component.
 {panel}
 {panel}
*style* a pass through to the root element of the component.
  *group* ID of button group component if this button is outside of the button group but wants to logically belong to the group.
 {panel}
 {panel}
 *styleClass* a pass through to the root element of the component.
 {panel}
 {panel}
 *tabindex* a pass through to the root element of the component, default=0.
 {panel}
 {panel}
 *disabled* a pass through to the root element of the component.
 {panel}
 {panel}
*singleSubmit* When singleSubmit attribute is true, the checkbox only submits an event request to the server representing an ajax call with execute=@this and render=@all, if false then only the hidden field is updated on the client and some other component must submit the form for the server model side to be updated.
  
 Default is "true"
  The following attributes are supported as pass-thru attributes: *accesskey*, *alt*, *dir*, *label*, *lang*, *style*, *tabindex*, *title*, *type*, *onchange*, *onselect*, *onclick*, *ondblclick*, *onkeydown*, *onkeypress*, *onkeyup*, *onmousedown*, *onmousemove*, *onmouseout*, *onmouseover*, *onmouseup*, *onblur*, *onfocus*
 {panel}
  
h3. ARIA and Keyboard Navigation Support
  h2. Event Listeners
  
To enable/disable ARIA at page level, the [<icecore:config>|Core Tags#icecoreconfig] tag can used:
  As a descendant of UIInput, this component supports a value change listener.
  
 | valueChangeListener | Method that will be notified when a new value has been set for this component |
  
 h2. Client Behavior Events
  
 | action | Fired when the button is clicked or pressed by any other means (default event). |
  
 {tip}Prior to 4.0 this event was named "activate". The "activate" event name is now deprecated but treated as an alias for "action" for backwards compatibility with existing applications.{tip}
  
 h2. JavaScript API
  
 h4. ICEfaces 3.x
  
 The client side component object is exposed through the global variable name specified in the *widgetVar* attribute.
  
 h4. ICEfaces 4+
  
 The "widgetVar" attribute on the ACE components has been removed in ICEfaces 4 and in its place a new "ice.ace.instance()" client JavaScript object lookup API has been introduced. The reason for this change is to enable lazy-initialization of the ACE component JavaScript objects to improve runtime performance and reduce browser memory use.
  
 {code}var widget = ice.ace.instance('frm:componentId);{code}
  
 {tip}The _ice.ace.instance_ function requires the _full_ client id of the component to be specified, such as "j_idt77:componentId" instead of just "componentId". To reduce the complexity of working with complete IDs with this function it may be preferable in some cases to use {{prependId="false"}} in the enclosing form (e.g. _<h:form prependId="false">_).{tip}
  
 {info}This component doesn't have a client-side API made specifically to be used by application developers. However, the component's internal methods and variables can be accessed in this way, including the underlying jQuery object and objects from underlying Javascript libraries (if applicable), and can be used for whatever purpose a developer might have in mind.
 {info}
  
 h2. Keyboard and ARIA Support
  
 Default browser keyboard support for {{<button>}} elements (i.e. tabbing in and out, pressing space to activate).
  
 The following ARIA roles are supported: checkbox.
  
 h2. CSS Classes
  
 The following markup represents the basic HTML structure of the component and the CSS classes it uses.
  
 {code:xml}
 <!-- Root container -->
 <div class="ice-checkboxbutton [user defined classes]" style="[user defined styles]">
  <span class="ui-button ui-widget">
  <span class="first-child">
  <button class="ui-corner-all ui-widget-content ice-checkboxbutton-checked">
  <!-- Icon -->
  <span class="fa fa-check-square-o fa-lg"></span>
  </button>
  </span>
  </span>
 </div>
 {code}
<icecore:config ariaEnabled="true"/>
 {code}
 To enable/disable ARIA at application level, the following param can be set in web.xml.
 {code}
 <context-param>
  <param-name>org.icefaces.aria.enabled</param-name>
  <param-value>false</param-value>
 </context-param>
 {code}
 {panel}
 * the space key will toggle the checkbox/checkbutton
 {panel}Aria _role="button"_, aria-describedby and aria-disabled properties supported as well as aria-checked.
 The ARIA implementation is based on the specification at [check box aria practices|http://www.w3.org/TR/wai-aria-practices/#checkbox]. Currently only the basic ARIA attributes and single-key keyboard shortcuts have been implemented.
  
h4. Storyboard
  h2. Known Issues
  
 || Action || focus || hover || checked || disabled || onkeypress || aria ||
 || yui-class | yui-button-focus | yui-button-hover | yui-button-checked | yui-button-disabled | space or enter will submit | role, disabled, description, checked ||
 || Submit | | | submit button &update component | none | submit button/update component | ||
 || Single Submit | | | stay on client/update hidden field | none | update hidden field | ||
 || Screen Reader | description | description | role,description, checkedvalue | role | & checked value | ||
  None.
  
 h2. Additional Resources
  
 None.

© Copyright 2021 ICEsoft Technologies Canada Corp.