Added a method for creating radio button form elements.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1158 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: FormTool.java,v 1.7 2002/11/09 00:48:51 mdb Exp $
|
// $Id: FormTool.java,v 1.8 2003/07/04 01:29:16 mdb Exp $
|
||||||
//
|
//
|
||||||
// samskivert library - useful routines for java programs
|
// samskivert library - useful routines for java programs
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -251,6 +251,23 @@ public class FormTool
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a radio button with the specified name and value.
|
||||||
|
*/
|
||||||
|
public String radio (String name, String value)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
if (value.equals(selectedValue)) {
|
||||||
|
buf.append(" checked");
|
||||||
|
}
|
||||||
|
buf.append(">");
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a text area with the specified name, optional extra
|
* Constructs a text area with the specified name, optional extra
|
||||||
* parameters, and default text.
|
* parameters, and default text.
|
||||||
|
|||||||
Reference in New Issue
Block a user