|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectau.id.jericho.lib.html.FormControlType
Represents one of the HTML control types in a form which have the potential to be successful. This means that they can contribute name/value pairs to the form data set when the form is submitted.
Each type of control has a certain behaviour in regards to the name/value pairs submitted. This class defines that behaviour, so that the meaning of the name/value pairs submitted from an arbitrary HTML page can be determined.
Use the StartTag.getFormControlType()
method to determine the type of control (if any) represented by
a start tag.
FormField
,
FormFields
Field Summary | |
static FormControlType |
BUTTON
<button type="submit" name="FieldName" value="PredefinedValue">Send</button> . |
static FormControlType |
CHECKBOX
<input type="checkbox" name="FieldName" value="PredefinedValue" /> . |
static FormControlType |
FILE
<input type="file" name="FieldName" value="DefaultFileName" /> . |
static FormControlType |
HIDDEN
<input type="hidden" name="FieldName" value="PredefinedValue" /> . |
static FormControlType |
IMAGE
<input type="image" name="FieldName" src="ImageURL" value="PredefinedValue" /> . |
static FormControlType |
PASSWORD
<input type="password" name="FieldName" value="DefaultValue" /> . |
static FormControlType |
RADIO
<input type="radio" name="FieldName" value="PredefinedValue" /> . |
static FormControlType |
SELECT_MULTIPLE
<select name="FieldName" multiple> <option value="PredefinedValue">Display Text</option> </select> . |
static FormControlType |
SELECT_SINGLE
<select name="FieldName"> <option value="PredefinedValue">Display Text</option> </select> . |
static FormControlType |
SUBMIT
<input type="submit" name="FieldName" value="PredefinedValue" /> . |
static FormControlType |
TEXT
<input type="text" name="FieldName" value="DefaultValue" /> . |
static FormControlType |
TEXTAREA
<textarea name="FieldName">Default Value</textarea> . |
Method Summary | |
boolean |
allowsMultipleValues()
Deprecated. Use the more useful FormField.allowsMultipleValues() method instead. |
static FormControlType |
get(java.lang.String formControlTypeId)
Returns the FormControlType with the specified ID. |
java.lang.String[] |
getAdditionalSubmitNames(java.lang.String name)
Deprecated. no replacement |
java.lang.String |
getFormControlTypeId()
Returns a string which identifies this form control type. |
java.lang.String |
getTagName()
Returns the name of the tag that defines this form control type. |
static boolean |
isPotentialControl(java.lang.String tagName)
Deprecated. no replacement |
boolean |
isPredefinedValue()
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. |
boolean |
isSelect()
Indicates whether this control type represents a select element. |
boolean |
isSubmit()
Indicates whether this control type causes the form to be submitted. |
java.lang.String |
toString()
Returns a string which identifies this form control type. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final FormControlType BUTTON
<button type="submit" name="FieldName" value="PredefinedValue">Send</button>
.
getFormControlTypeId()
= "button"
getTagName()
= Tag.BUTTON
isPredefinedValue()
= true
isSubmit()
= true
public static final FormControlType CHECKBOX
<input type="checkbox" name="FieldName" value="PredefinedValue" />
.
getFormControlTypeId()
= "checkbox"
getTagName()
= Tag.INPUT
isPredefinedValue()
= true
isSubmit()
= false
public static final FormControlType FILE
<input type="file" name="FieldName" value="DefaultFileName" />
.
getFormControlTypeId()
= "file"
getTagName()
= Tag.INPUT
isPredefinedValue()
= false
isSubmit()
= false
public static final FormControlType HIDDEN
<input type="hidden" name="FieldName" value="PredefinedValue" />
.
getFormControlTypeId()
= "hidden"
getTagName()
= Tag.INPUT
isPredefinedValue()
= false
isSubmit()
= false
Note that isPredefinedValue()
returns false
for this control type because the value of hidden fields is usually set via server or client side scripting.
public static final FormControlType IMAGE
<input type="image" name="FieldName" src="ImageURL" value="PredefinedValue" />
.
getFormControlTypeId()
= "image"
getTagName()
= Tag.INPUT
isPredefinedValue()
= true
isSubmit()
= true
public static final FormControlType PASSWORD
<input type="password" name="FieldName" value="DefaultValue" />
.
getFormControlTypeId()
= "password"
getTagName()
= Tag.INPUT
isPredefinedValue()
= false
isSubmit()
= false
public static final FormControlType RADIO
<input type="radio" name="FieldName" value="PredefinedValue" />
.
getFormControlTypeId()
= "radio"
getTagName()
= Tag.INPUT
isPredefinedValue()
= true
isSubmit()
= false
public static final FormControlType SELECT_MULTIPLE
<select name="FieldName" multiple> <option value="PredefinedValue">Display Text</option> </select>
.
getFormControlTypeId()
= "select_multiple"
getTagName()
= Tag.SELECT
isPredefinedValue()
= true
isSubmit()
= false
public static final FormControlType SELECT_SINGLE
<select name="FieldName"> <option value="PredefinedValue">Display Text</option> </select>
.
getFormControlTypeId()
= "select_single"
getTagName()
= Tag.SELECT
isPredefinedValue()
= true
isSubmit()
= false
public static final FormControlType SUBMIT
<input type="submit" name="FieldName" value="PredefinedValue" />
.
getFormControlTypeId()
= "submit"
getTagName()
= Tag.INPUT
isPredefinedValue()
= true
isSubmit()
= true
public static final FormControlType TEXT
<input type="text" name="FieldName" value="DefaultValue" />
.
getFormControlTypeId()
= "text"
getTagName()
= Tag.INPUT
isPredefinedValue()
= false
isSubmit()
= false
public static final FormControlType TEXTAREA
<textarea name="FieldName">Default Value</textarea>
.
getFormControlTypeId()
= "textarea"
getTagName()
= Tag.TEXTAREA
isPredefinedValue()
= false
isSubmit()
= false
Method Detail |
public java.lang.String getFormControlTypeId()
This is the same as the control type's static field name in lower case, which is one of
button
, checkbox
, file
, hidden
, image
,
password
, radio
, select_multiple
, select_single
,
submit
, text
, or textarea
.
public java.lang.String getTagName()
public boolean isPredefinedValue()
The predefined value is defined by the control's initial value.
Note that the HIDDEN
type returns false
for this method because the value of hidden fields is usually set via server or client side scripting.
true
if any value submitted by this type of control is predefined in the HTML and typically not modified by the user or server/client scripts, otherwise false
.public boolean isSubmit()
Returns true
only for the SUBMIT
, BUTTON
, and IMAGE
instances.
true
if this control type causes the form to be submitted, otherwise false
.public boolean isSelect()
select
element.
Returns true
only for the SELECT_SINGLE
and SELECT_MULTIPLE
instances.
This method is exactly equivalent to testing getTagName()
==
Tag.SELECT
.
true
if this control type represents a select
element, otherwise false
.public static FormControlType get(java.lang.String formControlTypeId)
FormControlType
with the specified ID.
formControlTypeId
- the ID of a form control type.
FormControlType
with the specified ID, or null
if no such control exists.getFormControlTypeId()
public java.lang.String toString()
This is equivalent to getFormControlTypeId()
.
public boolean allowsMultipleValues()
FormField.allowsMultipleValues()
method instead.
Returns false
only for the RADIO
, SUBMIT
, BUTTON
, and IMAGE
instances.
Note that before version 1.5 this method also returned false
for the SELECT_SINGLE
instance.
This was a bug resulting from confusion as to whether each option
element in a
select
element constituted a control (since it is possible for multiple options to be
successful)
or only the select
element as a whole.
The FormControl
class now clearly defines the control as the entire select
element,
meaning that multiple SELECT_SINGLE
controls with the same name will result in multiple values.
Because this may not be immediately intuitive, and the method is no longer used internally, this method has been deprecated as of version 1.5 to avoid any further confusion.
true
if more than one control of this type with the same name can be successful, otherwise false
.public java.lang.String[] getAdditionalSubmitNames(java.lang.String name)
Returns null
for all control types except IMAGE
.
It relates to the extra name.x
and name.y
data submitted when a pointing device is used to activate an IMAGE control.
This method has been deprecated as of version 1.5 as it is no longer used internally and was never very useful as a public method.
name
- the name of a form control.
null
if none.public static boolean isPotentialControl(java.lang.String tagName)
Returns true
if the specified tag name is one of
"input", "textarea", "button" or "select" (ignoring case).
This method has been deprecated as of version 1.5 as it is no longer used internally and was never very useful as a public method.
tagName
- the name of an HTML tag.
true
if an HTML tag with the specified name is potentially a form control, otherwise false
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |