public abstract class AbstractText extends Field
Important note: the trimValues(boolean)
method
will by default trim whitespace from the beginning/end of
user input. If the resulting string is empty (""), then
it will be treated as if the user had not entered anything.
(which is typically the desired behavior).
Field.Type
Modifier and Type | Method and Description |
---|---|
boolean |
getBooleanValue(FormData fd)
Convenience method that returns the value of this field as a boolean.
|
double |
getDoubleValue(FormData fd)
Convenience method that returns the value of this field as a
Double.
|
float |
getFloatValue(FormData fd)
Convenience method that returns the value of this field as a
Float.
|
int |
getIntValue(FormData fd)
Convenience method that returns the value of this
field as a Integer.
|
short |
getShortValue(FormData fd)
Convenience method that returns the value of this field as a
Short.
|
String |
getStringValue(FormData fd)
Convenience method that returns the value of this field as a String.
|
String |
getValue(FormData fd)
Returns a string representing the value of this field or null if
there is no current value.
|
boolean |
isFilled(FormData fd)
Returns true if this field was isFilled out or selected by the
user, false otherwise.
|
void |
reset(FormData fd) |
void |
setValue(FormData fd,
String value)
Sets the selected values for this select in the specified form data.
|
void |
setValue(String value)
Sets the initial value of this text element to the specified string.
|
void |
setValueFromSubmit(FormData fd,
javax.servlet.http.HttpServletRequest req)
Sets the value of the field from the submitted form data.
|
String |
toString() |
void |
trimValues(boolean val)
Trims leading and ending spaces from all entered values.
|
add, addError, addLabel, addString, disable, disable, enable, enable, getLabel, getName, getType, getValidateErrors, isEnabled, render, render, render, renderError, renderError, renderImpl, renderStyleTag, setStyleTag, validate
public void setValueFromSubmit(FormData fd, javax.servlet.http.HttpServletRequest req) throws SubmitHackedException
setValueFromSubmit
in class Field
fd
- the form data object to store the value inSubmitHackedException
public void setValue(String value)
public void setValue(FormData fd, String value)
If the form has not been submitted, there is no form data object. A form data object should be manually created if needed for storing the value.
fd
- the non-null form data used for rendering the formvalue
- the value to be setpublic String getValue(FormData fd)
public String getStringValue(FormData fd)
NumberFormatException
- if the value could not be
returned as in integer.public int getIntValue(FormData fd)
NumberFormatException
- if the value could not be
returned as an integer.public short getShortValue(FormData fd)
NumberFormatException
- if the value could not be
returned as a short.public float getFloatValue(FormData fd)
NumberFormatException
- if the value could not be
returned as a float.public double getDoubleValue(FormData fd)
NumberFormatException
- if the value could not be
returned as a double.public boolean getBooleanValue(FormData fd)
Boolean.valueOf(String)
method.public boolean isFilled(FormData fd)
Field
Note: Some fields like selects will never be empty since non-multiple select fields always send their default selected value. [although select/with/multiple can be empty since the browser sends (much like radio buttoms) nothing at all when no option is selected].
public void trimValues(boolean val)