001 // Copyright (c) 2001 Hursh Jain (http://www.mollypages.org)
002 // The Molly framework is freely distributable under the terms of an
003 // MIT-style license. For details, see the molly pages web site at:
004 // http://www.mollypages.org/. Use, modify, have fun !
005
006 package fc.web.forms;
007
008 import javax.servlet.*;
009 import javax.servlet.http.*;
010 import java.io.*;
011 import java.util.*;
012 import java.util.regex.*;
013 import java.util.logging.*;
014
015 import fc.jdbc.*;
016 import fc.io.*;
017 import fc.util.*;
018
019 /**
020 Represents a HTML form's checkbox element.
021
022 @author hursh jain
023 **/
024 public final class Checkbox extends Choice
025 {
026 /**
027 Creates a new checkbox object.
028
029 @param name the field name
030 @param value the value of this choice item
031 @param selected <tt>true</tt> is this choice is
032 originally selected
033 **/
034 public Checkbox(String name, String value, boolean selected)
035 {
036 super(name, value, selected);
037 }
038
039 /**
040 Constructs a new unselected checkbox with the specified value
041 and HTML text.
042
043 @param name the name of this choice
044 @param value the value of this choice item
045 **/
046 public Checkbox(String name, String value) {
047 this(name, value, false);
048 }
049
050 /**
051 Constructs a new checkbox which is selected/unselected as specified.
052
053 @param name the name of this choice
054 @param selected <tt>true</tt> to select this checkbox.
055 **/
056 public Checkbox(String name, boolean selected) {
057 this(name, null, selected);
058 }
059
060
061 /**
062 Constructs a new unselected checkbox with no separate
063 value attribute
064
065 @param name the name of this choice
066 **/
067 public Checkbox(String name) {
068 this(name, null, false);
069 }
070
071 public Field.Type getType() {
072 return Field.Type.CHECKBOX;
073 }
074
075 }