Renders a collection of radiobutton options and handles the data binding of their values.
<netui:radioButtonGroup
dataSource="expression_datasource"
[defaultValue="string_or_expression_default"]
[disabled="boolean_disabled"]
[labelStyle="string_labelStyle"]
[labelStyleClass="string_class"]
[optionsDataSource="expression_datasource"]
[style="string_Style"]
[styleClass="string_Class"]
[tagId="string_tagId"] />
The <netui:radioButtonGroup> tag can generate a set of radiobutton options in two ways:
- they can be dynamically generated by pointing the <netui:radioButtonGroup> tag at a java.util.HashMap or String[] object
- they can be statically generated by providing a set of children <netui:radioButtonOption> tags
Dynamically Generated Radiobutton Options
You can dynamically generate a set of radionbutton options by pointing the <netui:radioButtonGroup> tag at a HashMap (or any object that implements the java.util.Map interface).
public HashMap hashMap = new HashMap(); hashMap.put("value1", "Display Text 1"); hashMap.put("value2", "Display Text 2"); hashMap.put("value3", "Display Text 3");
To point the <netui:radioButtonGroup>
at the Map object use the optionsDataSource
attribute.
<netui:radioButtonGroup optionsDataSource="{pageFlow.hashMap}">
In the generated radiobutton options, the display text and the submitted value can be made to differ. The HashMap keys will form the submitted values, while the HashMap entries will form the display texts.
<input type="radio" value="value1">Display Text 1</input> <input type="radio" value="value2">Display Text 2</input> <input type="radio" value="value3">Display Text 3</input>
Note that you can point the <netui:radioButtonGroup> tag at a String[] object. A set of radiobutton options will be generated, but there will be no difference between the display texts and the submitted values.
Statically Generated Radiobutton Options
To statically generate radiobutton options, place a set of <netui:radioButtonOption> tags inside the <netui:radioButtonGroup> tag.
<netui:radioButtonGroup dataSource="{actionForm.selection}"> <netui:radioButtonOption value="value1">Display Text 1</netui:radioButtonOption><br> <netui:radioButtonOption value="value2">Display Text 2</netui:radioButtonOption><br> <netui:radioButtonOption value="value3">Display Text 3</netui:radioButtonOption><br> </netui:radioButtonGroup>
Submitting Radionbutton Options
A <netui:radioButtonGroup> is submitted as a String value. Use the dataSource
attribute
to submit to a String object.
<netui:radioButtonGroup dataSource="{actionForm.selection}">
In this case, the <netui:radioButtonGroup> submits to a String field of a Form Bean.
public static class ProcessDataForm extends FormData { private String selection; public void setSelection(String selection) { this.selection = selection; } public String getSelection() { return this.selection; } }
dataSource | The For example, assume that the Controller file (= JPF file) contains a Form Bean with the property foo. Then the following <netui:textBox> tag will (1) draw populating data from the Form Bean's foo property and (2) submit user defined data to the same property. The When the tag is used to submit data, the data binding expression must refer to a Form Bean property. In cases where the tag is not used to submit data, but is used for displaying data only, the data binding expression need not refer to a Form Bean property. For example, assume that myIterativeData is a member variable on the Controller file ( = JPF file). The following <netui-data:repeater> tag draws its data from myIterativeData. |
||||||
|
|||||||
|
|||||||
defaultValue | Use in <netui:checkBoxGroup>, <netui:checkBox>, <netui:radioButtonGroup>, and <netui:select> tags Sets the preselected value or values. The If the If the Use in <netui:textArea> and <netui:textBox> tags Sets the initial display text. The |
||||||
|
|||||||
|
|||||||
disabled | Boolean. If set to true, the group will be visible, but diabled. | ||||||
|
|||||||
|
|||||||
labelStyle | The style of the label for each contained <netui:radioButtonOption> tag. | ||||||
|
|||||||
|
|||||||
labelStyleClass | The class of the labels for each contained <netui:radioButtonOption> tag. | ||||||
|
|||||||
|
|||||||
optionsDataSource | The In a <netui:select> tag, the options are
rendered as a set of <netui:option> tags.
The options can be determined dynamically by pointing the
If a java.util.Map object is used, the display name and underlying value of each option may be set independently. (The display name will be rendered based on the value of each Map entry; the underlying value will be rendered based on the key of each Map entry.) If a String[] object is used, the display name and underlying value of each option will be identical. See the Description and Sample sections of this topic for details. Use a data binding expression to point the
|
||||||
|
|||||||
|
|||||||
style | Sets the style of the rendered HTML tag. | ||||||
|
|||||||
|
|||||||
styleClass | The class of the rendered HTML tag. | ||||||
|
|||||||
|
|||||||
tagId | String value. Sets the For example, assume that some tag's <netui:textBox tagId="foo" /> Then the following JavaScript function will return the real id attribute rendered in the browser: getNetuiTagName( "foo", this ) To get a <netui:form> element and all of its children elements in JavaScript, use
the same JavaScript function <netui:form tagId="bar" > Then the following JavaScript function will return the <netui:form> element and its children (packaged as an array). document[getNetuiTagName( "bar", this )] To retreive the value entered into a <netui:textBox> within the <netui:form> tag, use the following JavaScript expression. document[getNetuiTagName("bar", this)][getNetuiTagName("foo", this)].value The second parameter ensures that the JavaScript function
begins its search within the correct Portlet scope. Pass the
JavaScript keyword |
||||||
|
|||||||
|
<netui:radioButtonGroup optionsDataSource="{pageFlow.hashMap}" dataSource="{actionForm.selection}" />Assuming that the
optionsDataSource
attribute refers to the following HashMap object...
public HashMap hashMap = new HashMap(); protected void onCreate() { hashMap.put("value1", "Display Text 1"); hashMap.put("value2", "Display Text 2"); hashMap.put("value3", "Display Text 3"); }...then the following HTML will be generated in the browser...
<netui:radioButtonGroup dataSource="{actionForm.selection}"> <netui:radioButtonOption value="value1">Display Text 1</netui:radioButtonOption><br> <netui:radioButtonOption value="value2">Display Text 2</netui:radioButtonOption><br> <netui:radioButtonOption value="value3">Display Text 3</netui:radioButtonOption><br> </netui:radioButtonGroup>
[BEA_HOME]/weblogic81/samples/SamplesApp/WebApp/tagSamples/netui/radioButtons/