|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.click.control.AbstractControl org.apache.click.control.Field org.apache.click.control.TextField
public class TextField
Provides a Text Field control: <input type='text'>.
Text Field |
TextField usernameField = new TextField("username"); usernameField.setRequired(true); usernameField.setSize(12); usernameField.setMaxLength(12); usernameField.setMinLength(6); form.add(usernameField);The TextField control will rendered HTML output:
<input type='text' name='username' value='' size='12' maxlength='12'>For another example using TextField see the
Form
Javadoc example.
See also the W3C HTML reference:
INPUT
Field Summary | |
---|---|
protected int |
maxLength
The maximum field length validation constraint. |
protected int |
minLength
The minimum field length validation constraint. |
protected int |
size
The text field size attribute. |
protected static String |
VALIDATE_TEXTFIELD_FUNCTION
The field validation JavaScript function template. |
Fields inherited from class org.apache.click.control.Field |
---|
disabled, error, focus, form, help, label, labelStyle, labelStyleClass, parentStyleClassHint, parentStyleHint, readonly, required, tabindex, title, trim, validate, value |
Fields inherited from class org.apache.click.control.AbstractControl |
---|
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles |
Fields inherited from interface org.apache.click.Control |
---|
CONTROL_MESSAGES |
Constructor Summary | |
---|---|
TextField()
Create a TextField with no name defined. |
|
TextField(String name)
Construct the TextField with the given name. |
|
TextField(String name,
boolean required)
Construct the TextField with the given name and required status. |
|
TextField(String name,
String label)
Construct the TextField with the given name and label. |
|
TextField(String name,
String label,
boolean required)
Construct the TextField with the given name, label and required status. |
|
TextField(String name,
String label,
int size)
Construct the TextField with the given name, label and size. |
|
TextField(String name,
String label,
int size,
boolean required)
Construct the TextField with the given name, label, size and required status. |
Method Summary | |
---|---|
int |
getControlSizeEst()
Return the estimated rendered control size in characters. |
int |
getMaxLength()
Returns the maximum field length validation constraint. |
int |
getMinLength()
Returns the minimum field length validation constraint. |
int |
getSize()
Return the field size. |
String |
getTag()
Return the textfield's html tag: input. |
String |
getType()
Return the input type: 'text'. |
String |
getValidationJavaScript()
Return the field JavaScript client side validation function. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the TextField. |
void |
setMaxLength(int maxLength)
Sets the maximum field length. |
void |
setMinLength(int minLength)
Sets the minimum field length validation constraint. |
void |
setSize(int size)
Set the field size. |
void |
validate()
Validate the TextField request submission. |
Methods inherited from class org.apache.click.control.Field |
---|
bindRequestValue, getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getState, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, onProcess, removeState, renderTagBegin, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParent, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setState, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth |
Methods inherited from class org.apache.click.control.AbstractControl |
---|
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, onDestroy, onInit, onRender, removeBehavior, removeStyleClass, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final String VALIDATE_TEXTFIELD_FUNCTION
protected int maxLength
protected int minLength
protected int size
Constructor Detail |
---|
public TextField(String name)
name
- the name of the fieldpublic TextField(String name, boolean required)
name
- the name of the fieldrequired
- the field required statuspublic TextField(String name, String label)
name
- the name of the fieldlabel
- the label of the fieldpublic TextField(String name, String label, boolean required)
name
- the name of the fieldlabel
- the label of the fieldrequired
- the field required statuspublic TextField(String name, String label, int size)
name
- the name of the fieldlabel
- the label of the fieldsize
- the size of the fieldpublic TextField(String name, String label, int size, boolean required)
name
- the name of the fieldlabel
- the label of the fieldsize
- the size of the fieldrequired
- the field required statuspublic TextField()
Method Detail |
---|
public String getTag()
getTag
in class AbstractControl
AbstractControl.getTag()
public int getMaxLength()
maxLength
property is greater than zero, the Field values length
will be validated against this constraint when processed.
If maxLength is greater than zero, it is rendered as the field
attribute 'maxlength'
public void setMaxLength(int maxLength)
maxLength
property is
greater than zero, the Field values length will be validated against
this constraint when processed.
If maxLength is greater than zero, it is rendered as the field
attribute 'maxlength'
maxLength
- the maximum field length validation constraintpublic int getMinLength()
minLength
property is greater than zero, the Field values length
will be validated against this constraint when processed.
public void setMinLength(int minLength)
minLength
property is greater than zero, the Field values length
will be validated against this constraint when processed.
minLength
- the minimum field length validation constraintpublic int getSize()
public void setSize(int size)
size
- the field sizepublic String getType()
public int getControlSizeEst()
AbstractControl
getControlSizeEst
in class AbstractControl
AbstractControl.getControlSizeEst()
public void render(HtmlStringBuffer buffer)
render
in interface Control
render
in class AbstractControl
buffer
- the specified buffer to render the control's output toAbstractControl.toString()
public void validate()
Error message bundle key names include:org.apache.click.control.MessageProperties
- field-maxlength-error
- field-minlength-error
- field-required-error
validate
in class Field
public String getValidationJavaScript()
getValidationJavaScript
in class Field
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |