You can drag the Checkbox component from the Palette's Basic category to the Visual Designer to create a single checkbox with an optional label.
If you want a set of checkboxes that is preformatted with labels in a group, you can use a Checkbox Group component instead.
You can drop a checkbox on a container component, like a table cell or group box.
A checkbox can represent any object, whether the object is of a predefined class like Boolean
, Byte
, Character
, Double
, Float
, Integer
, Long
, Short
, String
, or of a class you define. A checkbox can also represent a primitive
value.
A single checkbox can be used to represent several types of data:
A group of checkboxes can be used to represent:
The checkbox component can be useful in situations where the Checkbox Group component layout is not desirable, such as a checkbox used to select or deselect a table row.
If you right-click the component, you can choose one of the following pop-up menu items:
validate
method so you can insert code to validate the value of the component.processValueChange
method so you can insert code that executes when the value of this component changes (for example, the user changes the value of another component that is controlling the value of this component)common_timeoutSubmitForm(this.form, 'component-id');
. At runtime, this code causes the form to be automatically submitted if the user changes the component value. Once the form is submitted, conversion and validation occur on the server and any value change listener methods execute, and then the page is redisplayed.
A component configured to Auto-Submit on Change can use virtual forms to limit the input fields that are processed when the form is submitted. If the auto-submit component is defined to submit a virtual form, only the participants in that virtual form will be processed when the auto-submit occurs.
selected
property to a data provider or an object so your application can evaluate it when the page is submitted. For more information, see Bind to Data Dialog Box.selected
property to other objects or bean properties that update this component's properties automatically. The checkbox component uses both the selected
and selectedValue
properties to pass information about the checkbox's selection status. The selected
property is used to indicate that the checkbox is selected, and a checkmark is displayed in the page. The selectedValue
property is used to pass a data value for the checkbox. A checkbox is considered to be selected when the value of the selected
property is equal to the value of the selectedValue
property. You can display a checkbox as selected on the initial viewing of the page by assigning the same value to the selectedValue
and the selected
properties.
If the selectedValue
property is not specified or its value is null
, the checkbox behaves like a boolean control. In this case, if the checkbox is selected, the value of the selected
property is a true Boolean
instance. If the checkbox is not selected, the value of the selected property is a false Boolean
instance.
A value binding expression that evaluates to a primitive value can be assigned to the selected
and selectedValue
properties.
If the selectedValue
property is not specified or its value is null
, the checkbox behaves like a boolean control.
To use the checkbox as a boolean control, do not specify a value for the selectedValue
property. The checkbox is selected if the selected
property is not null and has the value of a true Boolean
instance or a boolean primitive value. If the checkbox is not selected, then the value of the selected property is a false Boolean
instance or boolean primitive.
true
values. The selectedValue
property can be assigned an application-defined object value to represent the value of a selected checkbox. If the checkbox is selected, the value of the selected
property is assigned the value of the selectedValue
property.
If the value of the selectedValue
property is an application-defined object, a converter must be registered to convert to and from a String
value. The converter is used to encode the checkbox value as the value of the HTML <input>
element and to decode the submitted value in a request. In addition, in order to detect a selected checkbox, the object must support an equals
method that returns true
when the value of the selectedValue
property is compared to the selected
property value.