|
|
|
Description
Provides a container group for Radio components. The
RadioGroup itself must be within a Form component. The
Radio and RadioGroup components work together to update a property of an
object, much like a more flexible version of a
PropertySelection.
This component should wrap around other Radio components.
|
See Also
Option,
PropertySelection,
Radio,
Select
|
Parameters
Name |
Type |
Direction |
Required |
Default |
Description |
selected |
Object |
in-out |
yes |
|
Read during rendering to determine which Radio will be the default.
Updated during rewinding (when the form is submitted) to indicate which
radio button was selected by the user.
|
disabled |
boolean |
int |
no |
no |
If true, then all contained Radio components will be disabled as well.
|
Body: rendered
Informal parameters: forbidden
Reserved parameters: none
|
Examples
This RadioGroup example illustrates an order form where a user can select the
order size. Note how the OrderPage.detach() method is used to reset the default
selected Radio button to Medium.
The title border effect is achieved using the HTML
<fieldset><legend>.. </legend>.. </fieldset> tags.
<form jwcid="orderForm">
<table cellpadding="4" cellspacing="4">
<tr><td>
<fieldset><legend>Order Size</legend>
<span jwcid="orderSizeRadioGroup">
<input type="radio" jwcid="smallOrderRadio"/> Small <br/>
<input type="radio" jwcid="mediumOrderRadio"/> Medium <br/>
<input type="radio" jwcid="largeOrderRadio"/> Large <br/>
<span/>
</fieldset>
</td></tr>
<tr align="right"><td><input type="submit" value="Order"></td></tr>
</table>
</form>
<component id="orderForm" type="RadioGroup">
<binding name="selected" expression='listeners.formSubmit'/>
</component>
<component id="orderSizeRadioGroup" type="RadioGroup">
<binding name="selected" expression='orderSize'/>
</component>
<component id="smallOrderRadio" type="Radio">
<binding name="value" expression='@OrderPage@SMALL'/>
</component>
<component id="mediumOrderRadio" type="Radio">
<binding name="value" expression='@OrderPage@MEDIUM'/>
</component>
<component id="largeOrderRadio" type="Radio">
<binding name="value" expression='@OrderPage@LARGE'/>
</component>
public OrderPage extends BasePage {
public final static Integer SMALL = new Integer(1);
public final static Integer MEDIUM = new Integer(2);
public final static Integer LARGE = new Integer(3);
private Integer orderSize = MEDIUM;
public void setOrderSize(Integer value) {
orderSize = value;
}
public Integer getOrderSize() {
return orderSize;
}
public void detach() {
orderSize = MEDIUM;
super.detach();
}
public formSubmit(IRequestCycle cycle) {
// process order
}
}
|