|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.click.control.AbstractControl
net.sf.click.control.Field
net.sf.click.control.FileField
Provides a File Field control: <input type='file'>.
| File Field |
maximum request size
and maximum file size
by configuring CommonsFileUploadService.
Note Browsers enforce the JavaScript value property as readonly
to prevent script based stealing of users files.
You can make the file field invisible by setting the CSS display attribute, for
example:
<form method="POST" enctype="multipart/form-data">
<input type="file" name="myfile" style="display:none" onchange="fileName=this.value">
<input type="button" value="open file" onclick="myfile.click()">
<input type="button" value="show value" onclick="alert(fileName)">
</form>
Please also see the references:
| Field Summary | |
protected FileItem |
fileItem
The DefaultFileItem after processing a file upload request. |
protected int |
size
The text field size attribute. |
protected static String |
VALIDATE_FILEFIELD_FUNCTION
The field validation JavaScript function template. |
| Fields inherited from class net.sf.click.control.Field |
disabled, error, focus, form, help, label, readonly, required, tabindex, title, validate, value |
| Fields inherited from class net.sf.click.control.AbstractControl |
actionListener, attributes, listener, listenerMethod, messages, name, parent, styles |
| Fields inherited from interface net.sf.click.Control |
CONTROL_MESSAGES |
| Constructor Summary | |
FileField()
Create an FileField with no name defined. |
|
FileField(String name)
Construct the FileField with the given name. |
|
FileField(String name,
boolean required)
Construct the FileField with the given name and required status. |
|
FileField(String name,
String label)
Construct the FileField with the given name and label. |
|
FileField(String name,
String label,
boolean required)
Construct the FileField with the given name, label and required status. |
|
FileField(String name,
String label,
int size)
Construct the FileField with the given name, label and size. |
|
| Method Summary | |
void |
bindRequestValue()
Set the fileItem property from the multi-part form data
submission. |
int |
getControlSizeEst()
Return the estimated rendered control size in characters. |
FileItem |
getFileItem()
Return the FileItem after processing the request, or null otherwise. |
int |
getSize()
Return the field size. |
String |
getTag()
Return the FileFields's html tag: input. |
String |
getType()
Return the input type: 'file'. |
String |
getValidationJavaScript()
Return the FileField JavaScript client side validation function. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the FileField. |
void |
setSize(int size)
Set the field size. |
void |
validate()
Validate the FileField request submission. |
| Methods inherited from class net.sf.click.control.Field |
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isValid, onInit, onProcess, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setListener, setParent, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setValue, setValueObject, setWidth |
| Methods inherited from class net.sf.click.control.AbstractControl |
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getHtmlImports, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, onDeploy, onDestroy, onRender, registerActionEvent, removeStyleClass, renderTagBegin, 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_FILEFIELD_FUNCTION
protected int size
protected FileItem fileItem
| Constructor Detail |
public FileField(String name)
name - the name of the field
public FileField(String name,
boolean required)
name - the name of the fieldrequired - the field required status
public FileField(String name,
String label)
name - the name of the fieldlabel - the label of the field
public FileField(String name,
String label,
boolean required)
name - the name of the fieldlabel - the label of the fieldrequired - the required status
public FileField(String name,
String label,
int size)
name - the name of the fieldlabel - the label of the fieldsize - the size of the fieldpublic FileField()
| Method Detail |
public String getTag()
getTag in class AbstractControlAbstractControl.getTag()public FileItem getFileItem()
public int getSize()
public void setSize(int size)
size - the field sizepublic String getType()
public String getValidationJavaScript()
getValidationJavaScript in class Fieldpublic void bindRequestValue()
fileItem property from the multi-part form data
submission.
bindRequestValue in class Fieldpublic int getControlSizeEst()
AbstractControl
getControlSizeEst in class AbstractControlAbstractControl.getControlSizeEst()public void render(HtmlStringBuffer buffer)
render in interface Controlrender in class AbstractControlbuffer - the specified buffer to render the control's output toAbstractControl.toString()public void validate()
- /click-control.properties
- file-required-error
validate in class Field
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||