JBoss.orgCommunity Documentation

Chapter 9. Rich inputs

9.1. <rich:autocomplete>
9.1.1. Basic usage
9.1.2. Interactivity options
9.1.3. Reference data
9.2. <rich:calendar>
9.2.1. Basic usage
9.2.2. Using a data model
9.2.3. Behavior and appearance
9.2.4. Time of day
9.2.5. <rich:calendar> events
9.2.6. Reference data
9.3. <rich:inplaceInput>
9.3.1. Basic usage
9.3.2. Interactivity options
9.3.3. Reference data
9.4. <rich:inplaceSelect>
9.4.1. Basic usage
9.4.2. Interactivity options
9.4.3. <rich:inplaceSelect> events
9.4.4. Reference data
9.5. <rich:inputNumberSlider>
9.5.1. Basic usage
9.5.2. Interactivity options
9.5.3. Reference data
9.6. <rich:inputNumberSpinner>
9.6.1. Basic usage
9.6.2. Interactivity options
9.6.3. Reference data
9.7. <rich:select>
9.7.1. Basic usage
9.7.2. Using <rich:select> as a combo-box
9.7.3. Reference data

Documentation in development

Some concepts covered in this chapter may refer to the previous version of Richfaces, version 3.3.3. This chapter is scheduled for review to ensure all information is up to date.

This chapter details rich components for user input and interaction.

The <rich:autocomplete> component is an auto-completing input-box with built-in Ajax capabilities. It supports client-side suggestions, browser-like selection, and customization of the look and feel.

To attach an auto-completion behavior to other components, use the <rich:autocompleteBehavior> behavior. Refer to ??? for full details on the <rich:autocompleteBehavior> behavior.

Figure 9.1. <rich:autocomplete>


The <rich:calendar> component allows the user to enter a date and time through an in-line or pop-up calendar. The pop-up calendar can navigate through months and years, and its look and feel can be highly customized.

Figure 9.2. <rich:calendar>


The <rich:calendar> component is presented as a pop-up by default, appearing as a text field with a button to expand the full pop-up calendar. To render the calendar in-line on the page instead, set popup="false. This displays the full calendar without the text field or display button.

To change the appearance of the display button from the standard calendar icon, use the buttonIcon and buttonIconDisabled attributes to replace the icon with a specified file. Alternatively, use the buttonLabel attribute to display text on the button without an icon. If buttonLabel is specified then both the buttonIcon and buttonIconDisabled attributes are ignored. To hide the text field box, set showInput="false".

To change the default position at which the pop-up calendar is shown relative to the text field and button, use the jointPoint and direction attributes. The jointPoint attribute refers to the corner of the text field and button with which the calendar will be aligned and the direction specifies which direction the pop-up calendar will span relative to the joint point. The default settings are jointPoint="bottom-left" and direction="bottom-right", causing the pop-up calendar to align with the bottom-left corner of the text field and span to the bottom-right, underneath the text field and button. The diagram shows the joint points and directions that can be used. Alternatively, set both jointPoint and direction attributes to auto to allow smart pop-up positioning. Figure 9.3, “Pop-up positioning” shows the different possible settings for the jointPoint and direction attributes.

Pop-up positioning is determined using the jointPoint and direction attributes. Values for the jointPoint attribute are shown in red, while values for the direction attribute are shown in black.

Figure 9.3. Pop-up positioning


The calendar features a Today button for locating today's date on the calendar. This can be set to three different values using the todayControlMode attribute:

  • hidden, which does not display the button;

  • select, the default setting, which scrolls the calendar to the current month and selects today's date; and

  • scroll, which scrolls the calendar to the current month but does not select today's date.

To make the entire calendar read-only, set readonly="true". This allows months and years to be browsed through with the arrow controls, but dates and times cannot be selected.

The <rich:inplaceInput> component allows information to be entered in-line in blocks of text, improving readability of the text. Multiple input regions can be navigated with keyboard navigation. The component has three functional states: the "view" state, where the component displays its initial setting, such as "click to edit"; the "edit" state, where the user can input text; and the "changed" state, where the new value for the component has been confirmed but can be edited again if required.

The <rich:inplaceSelect> component is similar to the <rich:inplaceInput> component, except that the <rich:inplaceSelect> component uses a drop-down selection box to enter text instead of a regular text field. Changes can be rendered either in-line or for the whole block, and inputs can be focused with keyboard navigation. The component has three functional states: the "view" state, where the component displays its initial setting, such as "click to edit"; the "edit" state, where the user can select a value from a drop-down list; and the "changed" state, where the new value for the component has been confirmed but can be edited again if required.

Figure 9.4. <rich:inplaceSelect>


The <rich:inputNumberSlider> component provides a slider for changing numerical values. Optional features include control arrows to step through the values, a tool-tip to display the value while sliding, and a text field for typing the numerical value which can then be validated against the slider's range.

Figure 9.5. <rich:inputNumberSlider>


The <rich:inputNumberSpinner> component is a single-line input field with buttons to increase and decrease a numerical value. The value can be changed using the corresponding directional keys on a keyboard, or by typing into the field.

Figure 9.6. <rich:inputNumberSpinner>


The <rich:select> component provides a drop-down list box for selecting a single value from multiple options. The component supports keyboard navigation and can optionally accept typed input as a combo-box.

Figure 9.7. <rich:select>