You can drag the Radio Button Group component
from
the Palette's Basic category to the Visual Designer to create a table initially
containing three radio buttons in a column.
The radio buttons are rendered in rows and columns in an HTML <table>
element. The number of rows is defined by the number of radio buttons. The number of columns is defined by the columns
property. The default layout is a single vertical column. If you want the radio buttons laid out in a single row, set the columns
property to the number of radio buttons.
A group of radio buttons can be used to represent various types of data, such as:
The items
property associates the component with an array, a collection, or a list of com.sun.rave.web.ui.model.Option
objects that populate the list. Right-click the component and choose Bind to Data to set this property, as described below.
In the Navigator window, you can see the default object that populates the list, which has a name similar to radioButtonGroup1DefaultOptions
. A quick way to change the default list items is to edit this object by right-clicking the component and choosing Configure Default Options, as described below.
You set the selected
property to associate the component with an object that picks up the item selected by the user. The first time the component is rendered, the option that corresponds to the value of the selected
property, if any, is marked as selected. When the user selects
a radio button, the component's selected
property contains the selected value. Right-click the component and choose Property Bindings to set this property, as described below.
After dragging the component to the Visual Designer, you can do a number of things with it:
id
attribute. In the page bean, this property's value is the name of the RadioButtonGroup
object.for
property is set to the first radio button in the group.label
property. Values are 1 (largest), 2, and 3 (smallest). The default value is 2. 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.
items
property to an object or to a data provider for a database table or JavaBeans object.
items
property to an object, select the Bind to Object tab and then select a bean property that will be used to populate the list. The bean property must be an Object
array, map, or collection whose members are all subclasses of com.sun.rave.web.ui.model.Option
.
items
property to a data provider for a database table or JavaBeans object that will be used to populate the list, select the Bind to Data Provider tab and choose a data provider. If there are none, you must add the database table or JavaBeans object to the page. For more information, see Binding a List Component to a Database. selected
property, which you can bind to an Object
array, array of primitives, or ArrayList
. You must have added the array to a managed bean, such as the session bean, as a property. You can use this bean property to evaluate what the user chose after the page is submitted.radioButtonGroup#defaultOptions
object and change the displayed radio buttons. It is more likely that you will want to bind the items
property to a database or object to use to set radio button group items, as described above under Bind to Data.