Wow, I am the fixedXXX champion lately. Adding a fixedCheckbox that does

not snag the value from the request.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1286 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
eric
2003-11-04 23:06:59 +00:00
parent 7830380a29
commit 2c1feb1380
@@ -1,5 +1,5 @@
//
// $Id: FormTool.java,v 1.13 2003/11/04 03:12:39 eric Exp $
// $Id: FormTool.java,v 1.14 2003/11/04 23:06:59 eric Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -259,11 +259,21 @@ public class FormTool
* default value.
*/
public String checkbox (String name, boolean defaultValue)
{
return
fixedCheckbox(name, ParameterUtil.isSet(_req, name, defaultValue));
}
/**
* Constructs a checkbox input field with the specified name and
* value.
*/
public String fixedCheckbox (String name, boolean value)
{
StringBuffer buf = new StringBuffer();
buf.append("<input type=\"checkbox\"");
buf.append(" name=\"").append(name).append("\"");
if (ParameterUtil.isSet(_req, name, defaultValue)) {
if (value) {
buf.append(" checked");
}
buf.append(">");