Added a form of radio() that takes a default value.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1642 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2005-05-07 02:22:41 +00:00
parent ff74aa9f60
commit 5a4cac1b78
@@ -311,12 +311,20 @@ public class FormTool
* Creates a radio button with the specified name and value.
*/
public String radio (String name, String value)
{
return radio(name, value, null);
}
/**
* Creates a radio button with the specified name and value.
*/
public String radio (String name, String value, String defaultValue)
{
StringBuffer buf = new StringBuffer();
buf.append("<input type=\"radio\"");
buf.append(" name=\"").append(name).append("\"");
buf.append(" value=\"").append(value).append("\"");
String selectedValue = getValue(name, null);
String selectedValue = getValue(name, defaultValue);
if (value.equals(selectedValue)) {
buf.append(" checked");
}