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 006package fc.web.forms; 007 008import javax.servlet.*; 009import javax.servlet.http.*; 010import java.io.*; 011import java.util.*; 012import java.util.regex.*; 013import java.util.logging.*; 014 015import fc.jdbc.*; 016import fc.io.*; 017import fc.util.*; 018 019/** 020Represents a HTML form's checkbox element. 021 022@author hursh jain 023**/ 024public final class Checkbox extends Choice 025{ 026/** 027Creates 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**/ 034public Checkbox(String name, String value, boolean selected) 035 { 036 super(name, value, selected); 037 } 038 039/** 040Constructs a new unselected checkbox with the specified value 041and HTML text. 042 043@param name the name of this choice 044@param value the value of this choice item 045**/ 046public Checkbox(String name, String value) { 047 this(name, value, false); 048 } 049 050/** 051Constructs 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**/ 056public Checkbox(String name, boolean selected) { 057 this(name, null, selected); 058 } 059 060 061/** 062Constructs a new unselected checkbox with no separate 063value attribute 064 065@param name the name of this choice 066**/ 067public Checkbox(String name) { 068 this(name, null, false); 069 } 070 071public Field.Type getType() { 072 return Field.Type.CHECKBOX; 073 } 074 075}