Table of Contents


Since 3.3

The ace:comboBox component is an advanced selection and text entry component. It primarily behaves like a text field, but it also provides pre-defined option items that users can select. It also offers ajax support, ARIA support, label positions, Themerollwe support and more flexibility in rendering the list. Option items are defined either by <f:selectItem> and <f:selectItems> tags or by using a custom facet to define a custom way of rendering the options, which can contain graphics and additional text, while separating that from the actual value of the option item.

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

Getting Started

In its simplest form, an ace:comboBox component only requires to have some options defined and to bind its value to a property in a backing bean.

<ace:comboBox value="#{}">
	<f:selectItem itemValue="" itemLabel="Calgary" />
	<f:selectItem itemValue="" itemLabel="Montreal" />
	<f:selectItem itemValue="" itemLabel="Ottawa" />
	<f:selectItem itemValue="" itemLabel="Toronto" />
	<f:selectItem itemValue="" itemLabel="Vancouver" />
	<ace:ajax />

It is also possible to define how the list is to be rendered and to include arbitrary components in it. In order to do this, the listValue, listVar and itemValue attributes must be defined, as well as a facet named 'row', which will define the way the list is rendered.

<ace:comboBox value="#{bean.color}" listValue="#{bean.colors}" listVar="color" itemValue="#{color.hexValue}">
	<f:facet name="row">
		<h:graphicImage value="#{color.imgPath}" />
		<h:outputText value="#{}" />
	<ace:ajax />
ace:autoCompleteEntry vs. ace:comboBox. The ace:autoCompleteEntry and the ace:comboBox components have similar functionality. However, they are better suited for different use cases. Use the ace:autoCompleteEntry component for large data sets and when the input can be completely arbitrary (e.g. a search engine). Because the results are filtered in the server side, it is possible to access far more results and filter them much faster than if they were in the client side. It is also recommended when doing more complex, custom filtering that cannot be done with the basic matching modes. The autocomplete capabilities of the ace:comboBox component are only client-side, so it is recommended for smaller data sets (<1000 possible values). It is also recommended for cases where the expected value 80% of the time is part of a set small set of options (<10), but you don't want to restrict the user from entering any other arbitrary input.
ace:comboBox vs. ace:selectMenu. The main difference between the ace:comboBox and the ace:selectMenu components is the autocomplete functionality of ace:comboBox. Use ace:selectMenu when the set of possible inputs is small and well-defined. Use ace:comboBox when you don't want to restrict the user from entering arbitrary input, but you still want to provide or suggest some common or expected pre-defined values for quickly selecting them.


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.

The value specifies a bean property to which the value of this component is bound to. The value can be entered by the user either by typing or by selecting an option from the drop-down list.

The listVar attribute specifies a variable name to use for referencing each data object in the list when the rendering is done via a facet.

The listValue attribute specifies the list of data objects that contains all possible options when the rendering is done via a facet.

The itemValue attribute is a ValueExpression that specifies the property of the data object to use as the value of the item for this component if it gets selected. This only applies when listvar is used and the rendering is done by means of a facet.

The showListOnInput attribute attribute is a boolean value that indicates whether the popup list should be displayed when typing in the text field or only when clicking the down arrow button.

Client Behavior Events

valueChange Fired when the value of the combo box changes.
blur Fired when the combo box loses focus.

JavaScript APIs

ICEfaces 3.x

The client side component object is exposed through the global variable name specified in the widgetVar attribute.

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.

var widget = ice.ace.instance('frm:componentId);
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">).
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.

Keyboard and ARIA Support

Arrow keys supported to navigate options up and down. Keyboard acceleration supported (after typing a character the first item that starts with such character is highlighted).

The following ARIA roles are supported: textbox.

Facet Rendering

It is possible to customize the way in which the option items are displayed by means of the 'row' facet. You can add any arbitrary content, and if some of that content is only there for presentation purposes and is not part of the value string, you can use the ui-combobox-item-ignore CSS class to ignore that text. In the example below, a color box is created with CSS, and an underscore character is used only to give some width to the box; since this character is not part of the value string, we add the ui-combobox-item-ignore CSS class to it.

<ace:comboBox id="selectTextColor" value="#{comboBoxFacetBean.textColor}" listVar="color" listValue="#{comboBoxFacetBean.textColors}" itemValue="#{color.hexValue}" label="Select text color: " labelPosition="top">
	<f:facet name="row">
		<h:panelGrid columns="3" width="100%" columnClasses="col50,col25,col25">
			<h:outputText value="#{}" />
			<h:outputText value="" />
			<!-- color box -->
			<h:outputText value="_" style="display:inline-block;width:20px;color:#{color.hexValue};background-color:#{color.hexValue};border:1px #000 solid;" styleClass="ui-selectmenu-item-ignore"/>
	<ace:ajax execute="@this" render="@all" />


This component supports built-in labels. The text specified in the label attribute will be rendered next to the main input field of this component. The position specified by labelPosition will determine where this label is going to be rendered; the possible values are left, right, top, bottom, none and inField (to render the label in the field itself).

Required Indicator

The requiredIndicator attribute specifies the text to be displayed next to the main input field when this component is marked as required. When, this component is not marked as required, then the text specified in the optionalIndicator is going to be rendered. The indicatorPosition attribute determines where this indicator text is going to the rendered; the possible values are left, right, top, bottom, labelLeft, labelRight, and none.

Required Styling

Then this component is marked as required, the main input field receives the CSS class ui-state-required, otherwise, it receives the CSS class ui-state-optional. When this component is marked as invalid by the app, it will be rendered with the CSS class ui-state-error. These CSS classes can be used to add custom styling to this component, in order indicate its current state in a more visual way.

CSS Classes

The following markup represents the basic HTML structure of the component and the CSS classes it uses.

<!-- Root container -->
<div class="ui-combobox [user defined classes]">
	<!-- Value area -->
	<span class="ui-widget ui-corner-all ui-state-default ui-combobox-value">
		<!-- Text field -->
		<input class="ui-inputfield ui-state-default ui-corner-left ui-state-optional" style="[user defined styles]" />
		<!-- Down arrow -->
		<div class="ui-state-default ui-corner-right">
			<div class="ui-icon ui-icon-triangle-1-s"></div>
	<!-- List of options -->
	<div class="ui-widget ui-widget-content ui-corner-all ui-combobox-list">
			<div class="ui-widget-content">
				<!-- Option label, visible to user -->
				<span class="ui-combobox-item-label">Option label</span>
				<!-- Actual option value (hidden) -->
				<span class="ui-combobox-item-value">Option value</span>

Additionally, the ui-combobox-item-ignore class name can be added when using the component in facet mode to components and elements that are rendered for display purposes but that are not part of the value that is submitted to the server.

Known Issues


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

© Copyright 2021 ICEsoft Technologies Canada Corp.