Enum FormControlType
- java.lang.Object
-
- java.lang.Enum<FormControlType>
-
- FormControlType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<FormControlType>
public enum FormControlType extends java.lang.Enum<FormControlType>
Represents the control type of aFormControl.Use the
FormControl.getFormControlType()method to determine the type of a form control.The following table shows the relationship between the HTML 4.01 specification control type descriptions, their associated
Elementnames and attributes, and theFormControlTypeconstants defined in this class:
Reset buttons and push buttons have no associatedDescription Element Name Distinguishing Attribute FormControlTypebuttons - submit button BUTTONtype="submit"BUTTONINPUTtype="submit"SUBMITtype="image"IMAGEbuttons - reset button BUTTON,INPUTtype="reset"- buttons - push button BUTTON,INPUTtype="button"- checkboxes INPUTtype="checkbox"CHECKBOXradio buttons INPUTtype="radio"RADIOmenus SELECTmultipleSELECT_MULTIPLEabsence of multipleSELECT_SINGLEtext input INPUTtype="text"TEXTtype="password"PASSWORDTEXTAREA- TEXTAREAfile select INPUTtype="file"FILEhidden controls INPUTtype="hidden"HIDDENobject controls OBJECT-- FormControlTypebecause they do not contribute to the form data set of a submitted form, and so have no relevance to the methods provided in theFormControland associated classes. If required they can be found and manipulated as normal elements.Object controls have no associated
FormControlTypebecause any data they might contribute to the form data set is entirely dependent on the class of object, the interpretation of which is is beyond the scope of this library.This library does not consider the
OPTIONelements found withinSELECTelements to be controls themselves, despite them being referred to as such in some parts of the HTML 4.01 specification. Hence the absence of anOPTIONcontrol type.- See Also:
FormControl,FormField
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BUTTONThe form control type given to a submit button control implemented using aBUTTONelement.CHECKBOXThe form control type given to a checkbox control.FILEThe form control type given to a file select control.HIDDENThe form control type given to a hidden control.IMAGEThe form control type given to a submit button control implemented using anINPUTelement with attributetype="image".PASSWORDThe form control type given to a text input control implemented using anINPUTelement with attributetype="password".RADIOThe form control type given to a radio button control.SELECT_MULTIPLESELECT_SINGLESUBMITThe form control type given to a submit button control implemented using anINPUTelement with attributetype="submit".TEXTThe form control type given to a text input control implemented using anINPUTelement with attributetype="text".TEXTAREAThe form control type given to a text input control implemented using aTEXTAREAelement.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetElementName()booleanhasPredefinedValue()Indicates whether any value submitted by this type of control is predefined in the HTML and typically not modified by the user or server/client scripts.booleanisSubmit()Indicates whether this control type causes the form to be submitted.static FormControlTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static FormControlType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BUTTON
public static final FormControlType BUTTON
The form control type given to a submit button control implemented using aBUTTONelement.- Example:
<button type="submit" name="FieldName" value="PredefinedValue">Send</button>- Properties:
-
getElementName()=HTMLElementName.BUTTON
hasPredefinedValue()= true
isSubmit()= true
-
CHECKBOX
public static final FormControlType CHECKBOX
The form control type given to a checkbox control.- Example:
<input type="checkbox" name="FieldName" value="PredefinedValue" />- Properties:
-
getElementName()=HTMLElementName.INPUT
hasPredefinedValue()= true
isSubmit()= false
-
FILE
public static final FormControlType FILE
The form control type given to a file select control.This library considers the submission value of this type of control to be consist of only the selected file name, regardless of whether the file content would normally be included in the form data set.
To determine manually whether the file content is included in the form data set, the
enctypeattribute of the control's associated FORM element can be examined. Although the exact behaviour is not defined in the HTML 4.01 specification, the convention is that the content is not included unless anenctypevalue of "multipart/form-data" is specified.For more information see the HTML 4.01 specification section 17.13.4 - Form content types.
- Example:
<input type="file" name="FieldName" value="DefaultFileName" />- Properties:
-
getElementName()=HTMLElementName.INPUT
hasPredefinedValue()= false
isSubmit()= false
-
HIDDEN
public static final FormControlType HIDDEN
The form control type given to a hidden control.- Example:
<input type="hidden" name="FieldName" value="DefaultValue" />- Properties:
-
getElementName()=HTMLElementName.INPUT
hasPredefinedValue()= false
isSubmit()= false
hasPredefinedValue()returnsfalsefor this control type because the value of hidden fields is usually set via server or client side scripting.
-
IMAGE
public static final FormControlType IMAGE
The form control type given to a submit button control implemented using anINPUTelement with attributetype="image".See the description under the heading "image" in the HTML 4.01 specification section 17.4.1 - Form control types created with INPUT.
When a form control of type
IMAGEis present in the form used to construct aFormFieldsinstance, three separateFormFieldobjects are created for the one control. One has the name specified in thenameattribute of theINPUTelement, and the other two have this name with the suffixes ".x" and ".y" appended to them to represent the additional click coordinates submitted by this control when activated using a pointing device.This type of control is also mentioned in the HTML 4.01 specification section 13.6.2 - Server-side image maps.
- Example:
<input type="image" name="FieldName" src="ImageURL" value="PredefinedValue" />- Properties:
-
getElementName()=HTMLElementName.INPUT
hasPredefinedValue()= true
isSubmit()= true
-
PASSWORD
public static final FormControlType PASSWORD
The form control type given to a text input control implemented using anINPUTelement with attributetype="password".- Example:
<input type="password" name="FieldName" value="DefaultValue" />- Properties:
-
getElementName()=HTMLElementName.INPUT
hasPredefinedValue()= false
isSubmit()= false
-
RADIO
public static final FormControlType RADIO
The form control type given to a radio button control.- Example:
<input type="radio" name="FieldName" value="PredefinedValue" />- Properties:
-
getElementName()=HTMLElementName.INPUT
hasPredefinedValue()= true
isSubmit()= false
-
SELECT_MULTIPLE
public static final FormControlType SELECT_MULTIPLE
The form control type given to a menu control implemented using aSELECTelement containing the attribute "multiple".SELECTelements that do not contain the attribute "multiple" are represented by theSELECT_SINGLEform control type.This is the only control type that can have multiple submission values within the one control. Contrast this with
CHECKBOXcontrols, which require multiple separate controls with the same name in order to contribute multiple submission values.The individual
OPTIONelements contained within a form control of this type can be obtained using theFormControl.getOptionElementIterator()method.The most efficient way to test whether a form control type is either
SELECT_MULTIPLEorSELECT_SINGLEis to test forgetElementName()==HTMLElementName.SELECT.- Example:
-
<select name="FieldName" multiple>
<option value="PredefinedValue1" selected>Display Text1</option>
<option value="PredefinedValue2">Display Text2</option>
</select> - Properties:
-
getElementName()=HTMLElementName.SELECT
hasPredefinedValue()= true
isSubmit()= false
-
SELECT_SINGLE
public static final FormControlType SELECT_SINGLE
The form control type given to a menu control implemented using aSELECTelement that does not contain the attribute "multiple".SELECTelements that do contain the attribute "multiple" are represented by theSELECT_MULTIPLEform control type.The individual
OPTIONelements contained within a form control of this type can be obtained using theFormControl.getOptionElementIterator()method.The most efficient way to test whether a form control type is either
SELECT_MULTIPLEorSELECT_SINGLEis to test forgetElementName()==HTMLElementName.SELECT.- Example:
-
<select name="FieldName">
<option value="PredefinedValue1" selected>Display Text1</option>
<option value="PredefinedValue2">Display Text2</option>
</select> - Properties:
-
getElementName()=HTMLElementName.SELECT
hasPredefinedValue()= true
isSubmit()= false
-
SUBMIT
public static final FormControlType SUBMIT
The form control type given to a submit button control implemented using anINPUTelement with attributetype="submit".- Example:
<input type="submit" name="FieldName" value="PredefinedValue" />- Properties:
-
getElementName()=HTMLElementName.INPUT
hasPredefinedValue()= true
isSubmit()= true
-
TEXT
public static final FormControlType TEXT
The form control type given to a text input control implemented using anINPUTelement with attributetype="text".- Example:
<input type="text" name="FieldName" value="DefaultValue" />- Properties:
-
getElementName()=HTMLElementName.INPUT
hasPredefinedValue()= false
isSubmit()= false
-
TEXTAREA
public static final FormControlType TEXTAREA
The form control type given to a text input control implemented using aTEXTAREAelement.- Example:
<textarea name="FieldName">Default Value</textarea>- Properties:
-
getElementName()=HTMLElementName.TEXTAREA
hasPredefinedValue()= false
isSubmit()= false
-
-
Method Detail
-
values
public static FormControlType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FormControlType c : FormControlType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FormControlType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getElementName
public java.lang.String getElementName()
-
hasPredefinedValue
public boolean hasPredefinedValue()
Indicates whether any value submitted by this type of control is predefined in the HTML and typically not modified by the user or server/client scripts.The word "typically" is used because the use of client side scripts can cause control types which normally have predefined values to be set by the user, which is a condition which is beyond the scope of this library to test for.
The predefined value is defined by the control's initial value.
A return value of
truesignifies that a form control of this type is a predefined value control.A return value of
falsesignifies that a form control of this type is a user value control.Note that the
HIDDENtype returnsfalsefor this method because the value of hidden fields is usually set via server or client side scripting.- Returns:
trueif any value submitted by this type of control is predefined in the HTML and typically not modified by the user or server/client scripts, otherwisefalse.
-
-