blob: b51ebd4e2ceb19ffc2e8903d957b33933c4932df [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- $Id$ -->
<html>
<head>
<title>RadioGroup</title>
<link rel="stylesheet" type="text/css" href="Tapestry.css" title="style">
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left"><A href="Radio.html"><IMG alt=Radio src="common-images/prev.png"></a></td>
<td align="middle"><A href="index.html"><IMG alt="Component Index" src="common-images/home.png" ></a></td>
<td align="right"><A href="RenderBlock.html"><IMG alt=RenderBlock src="common-images/next.png"></a></td>
<tr>
<tr>
<td colspan="3"><hr></td>
</tr>
<tr>
<td colspan="3">
<table border="0" cellpadding="4" cellspacing="4" width="100%">
<tr valign="top">
<td>
<table>
<tr>
<td><font size="+2"><b>RadioGroup</b></font></td>
</tr>
<tr>
<td>
<A href="../api/org/apache/tapestry/form/RadioGroup.html">org.apache.tapestry.form.RadioGroup</a>
</td>
</tr>
</table>
</td>
<td>
<table align="right" valign="middle" bgcolor="#c0c0c0" cellpadding="8">
<tr>
<td>
<fieldset><legend>Size</legend>
&nbsp;&nbsp;<input type="radio" checked name="1">Regular&nbsp;&nbsp;<br>
&nbsp;&nbsp;<input type="radio" name="1">Large&nbsp;&nbsp;<br>
&nbsp;&nbsp;<input type="radio" name="1">Super&nbsp;&nbsp;<br>
</fieldset>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="center">
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">
<b>Description</b>
<br>
Provides a container group for <A href="Radio.html">Radio</a> components. The
RadioGroup itself must be within a <A href="Form.html">Form</a> component. The
Radio and RadioGroup components work together to update a property of an
object, much like a more flexible version of a
<A href="PropertySelection.html">PropertySelection</a>.
<p>
This component should wrap around other <A href="Radio.html">Radio</a> components.</p>
</td>
</tr>
<tr>
<td colspan="2">
<b>See Also</b>
<br>
<A href="Option.html">Option</a>,
<A href="PropertySelection.html">PropertySelection</a>,
<A href="Radio.html">Radio</a>,
<A href="Select.html">Select</a>
</td>
</tr>
<tr>
<td colspan="2">
<b>Parameters</b>
<br>
<table border="1" cellpadding="4" cellspacing="4" class="parameters">
<tr>
<th>Name</th>
<th>Type</th>
<th>Direction</th>
<th>Required</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>selected</td>
<td>Object</td>
<td>in-out</td>
<td>yes</td>
<td>&nbsp;</td>
<td>
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.
</td>
</tr>
<tr>
<td>disabled</td>
<td>boolean</td>
<td>int</td>
<td>no</td>
<td>no</td>
<td>
If true, then all contained Radio components will be disabled as well.
</td>
</tr>
</table>
<BR>
Body: <STRONG>rendered</STRONG><BR>
Informal parameters: <STRONG>forbidden</STRONG><br>
Reserved parameters: <EM>none</EM>
</td>
</tr>
<tr>
<td colspan="2">
<b>Examples</b>
<p>
This RadioGroup example illustrates an order form where a user can select the
order size. Note how the <tt>OrderPage.detach()</tt> method is used to reset the default
selected Radio button to Medium.
<p/>
The title border effect is achieved using the HTML
&lt;fieldset&gt;&lt;legend&gt;..&nbsp;&lt;/legend&gt;..&nbsp;&lt;/fieldset&gt; tags.
<p/>
<table class="examples" cellpadding="4" cellspacing="4">
<tr>
<td>
<fieldset><legend>Order Size</legend>
&nbsp;&nbsp;<input type="radio" name="2"/>Small<br>
&nbsp;&nbsp;<input type="radio" checked name="2"/>Medium&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;<input type="radio" name="2"/>Large<br>
</fieldset>
</td>
</tr>
<tr align="right">
<td><input type="submit" value="Order"></td>
</tr>
</table>
<pre>
&lt;form jwcid="@<a href="Form.html">Form</a>" listener='ognl:listeners.formSubmit'&gt;
&lt;table cellpadding="4" cellspacing="4"&gt;
&lt;tr&gt;&lt;td&gt;
&lt;fieldset&gt;&lt;legend&gt;Order Size&lt;/legend&gt;
&lt;span jwcid="<span class="jwcid">@<a href="RadioGroup.html">RadioGroup</a></span>" selected='ognl:orderSize'&gt;
&lt;input type="radio" jwcid="@<a href="Radio.html">Radio</a>" value='ognl:@OrderPage@SMALL'/&gt; Small &lt;br/&gt;
&lt;input type="radio" jwcid="@<a href="Radio.html">Radio</a>" value='ognl:@OrderPage@MEDIUM'/&gt; Medium &lt;br/&gt;
&lt;input type="radio" jwcid="@<a href="Radio.html">Radio</a>" value='ognl:@OrderPage@LARGE'/&gt; Large &lt;br/&gt;
&lt;/span&gt;
&lt;/fieldset&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr align="right"&gt;&lt;td&gt;&lt;input type="submit" value="Order"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;property-specification name=&quot;orderSize&quot; type=&quot;java.lang.Integer&quot; initial-value=&quot;@OrderPage@MEDIUM&quot;/&gt;<br>
public abstract 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);
public abstract Integer getOrderSize();
public formSubmit(IRequestCycle cycle) {
// process order
}
}
</pre>
</td>
</tr></table>
</td></tr>
<tr>
<td colspan="3"><hr></td>
</tr>
<tr>
<td align="left"><A href="Radio.html"><IMG alt=Radio src="common-images/prev.png"></a></td>
<td align="middle"><A href="index.html"><IMG alt="Component Index" src="common-images/home.png" ></a></td>
<td align="right"><A href="RenderBlock.html"><IMG alt=RenderBlock src="common-images/next.png"></a></td>
</tr>
</table>
</body>
</html>