Added support for checkbox form elements.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@403 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: FormTool.java,v 1.2 2001/11/01 00:22:48 mdb Exp $
|
// $Id: FormTool.java,v 1.3 2001/11/01 00:28:30 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
|
||||||
@@ -169,6 +169,22 @@ public class FormTool
|
|||||||
return fixedInput("hidden", name, value, "");
|
return fixedInput("hidden", name, value, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a checkbox input field with the specified name and
|
||||||
|
* default value.
|
||||||
|
*/
|
||||||
|
public String checkbox (String name, boolean defaultValue)
|
||||||
|
{
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
buf.append("<input type=\"checkbox\"");
|
||||||
|
buf.append(" name=\"").append(name).append("\"");
|
||||||
|
if (ParameterUtil.isSet(_req, name)) {
|
||||||
|
buf.append(" checked");
|
||||||
|
}
|
||||||
|
buf.append(">");
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an input form field with the specified type, name,
|
* Generates an input form field with the specified type, name,
|
||||||
* defaultValue and extra attributes.
|
* defaultValue and extra attributes.
|
||||||
|
|||||||
Reference in New Issue
Block a user