formelements
[ class tree: formelements ] [ index: formelements ] [ all elements ]

Class: InputFile

Source Location: /HtmlForm.FormElement.InputFile.class.php

Class Overview

FormElement
   |
   --InputText
      |
      --InputFile

Wraps a file-upload text-input.


Author(s):

  • Sebastian Schlapkohl

Version:

  • 1.0

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: InputText

InputText::__construct()
Hidden constructor.
InputText::doRender()
Compiles and returns the html-fragment for the element.
InputText::get()
Factory method for InputText, returns new instance.
InputText::getValue()
Returns the current value of the element.
InputText::printMaxLength()
Compiles and returns the html-maxlength-attribute for the element.
InputText::printReadonly()
Compiles and returns the html-readonly-attribute for the element.
InputText::printSize()
Compiles and returns the html-size-attribute for the element.
InputText::refill()
Tries to refill the element-value from existing data.
InputText::setMaxLength()
Sets the maximum amount of characters that can be inserted into the input.
InputText::setReadonly()
Sets that the element should be read-only.
InputText::setSize()
Sets the amount of characters the input should hold horizontally.
InputText::setText()
Sets the text to start with.
InputText::validate()
Starts the validation-process for the element.

Class: FormElement

FormElement::__construct()
General abstract, hidden formelement constructor.
FormElement::addCssClasses()
Adds one or many css-classes to the element's class-attribute.
FormElement::addElement()
Adds a subelement to the element.
FormElement::determineRefiller()
Returns the supposed source of refill values.
FormElement::doRender()
Returns the compiled html-code for the element.
FormElement::getId()
Return the element's html-id.
FormElement::getLabel()
Return the element's label text.
FormElement::getMasterElement()
Return the currently connected owner element for the element.
FormElement::getMasterForm()
Returns the currently connected owner form for the element.
FormElement::getName()
Return the element's html-name.
FormElement::getSubElements()
Return all owned elements of this element.
FormElement::getTitle()
Return the element's html-title.
FormElement::getValidator()
Return the currently connected validator for the element.
FormElement::getValue()
Returns the value of the element if there is any.
FormElement::getValueSet()
Returns the compiled valueset for this element including the elements owned by this one.
FormElement::insertElementAfter()
Searches the subelements of the element if present and inserts a given element after the first found one.
FormElement::isValid()
Answers if the element is in a valid state at the moment.
FormElement::needsUtf8Safety()
Answers if the element needs to be treated with precautions according to possible utf-8 values.
FormElement::printCssClasses()
Compiles the html-class-attribute-string of the element.
FormElement::printDisabled()
Compiles the html-disabled-attribute-string of the element.
FormElement::printId()
Compiles the html-id-attribute-string of the element.
FormElement::printJavascriptEventHandler()
Compiles html-javascript-eventhandler-string of the element.
FormElement::printJavascriptValidationCode()
Grabs the compiled JS-validation-code for the element from its validator, if present and returns the code as a string.
FormElement::printMessages()
Returns a string of all aggregated error messages of the element.
FormElement::printName()
Compiles the html-name-string of the element.
FormElement::printNameArray()
Comiles the html-name-string of the element, if the element is part of a group of values.
FormElement::printTabIndex()
Calculates current ongoing tabindex of the form, refreshes it and returns the proper value for the element.
FormElement::printTitle()
Compiles the html-title-string of the element.
FormElement::printWrapperClasses()
Compiles a string of all classes for the tag-wrapper for the element's html-code.
FormElement::setCssClasses()
Sets the html-class-attribute for the element.
FormElement::setDisabled()
Set the element disabled.
FormElement::setId()
Sets the html-id for this element.
FormElement::setJavascriptEventHandler()
Sets a javascript-handler for the element.
FormElement::setLabel()
Inserts a label for the element.
FormElement::setMasterElement()
Sets the owning element for an element.
FormElement::setMasterForm()
Sets the owning form for an element and by doing so inserts the element into the logical structure of the form.
FormElement::setTitle()
Sets the html-title for this element.
FormElement::setUsable()
Set the element usables or disabled based on an expression.
FormElement::setValidator()
Sets a validator for a value-bearing element.
FormElement::validate()
Starts validation for the element and all subelements according to the rules laid out in the element's validator.

Class Details

[line 26]
Wraps a file-upload text-input.

Be aware that you have to change the enctype of the form to "multipart/form-data", if you want to use this element in combination with other value-elements. Otherwise there won't be entries in $_FILES to work with.

Refills won't work on this element, due to security restrictions of the browsers.




Tags:

author:  Sebastian Schlapkohl
version:  1.0


[ Top ]


Class Methods


static method get [line 53]

static InputFile get( String $name, [String $id = ''])

Factory method for InputFile, returns new instance.

Factories are used to make instant chaining possible.




Tags:

return:  new InputFile-instance
access:  public


Overrides InputText::get() (Factory method for InputText, returns new instance.)

Parameters:

String   $name   html-name for the element
String   $id   html-id for the element

[ Top ]

constructor __construct [line 37]

InputFile __construct( String $name, [String $id = ''])

Hidden constructor.

Get new instances with "get()" instead.




Tags:

access:  protected


Overrides InputText::__construct() (Hidden constructor.)

Parameters:

String   $name   html-name for the element
String   $id   html-id for the element

[ Top ]

method doRender [line 118]

String doRender( )

Compiles and returns the html-fragment for the element.



Tags:

return:  html-fragment for the element
access:  public


Overrides InputText::doRender() (Compiles and returns the html-fragment for the element.)

[ Top ]

method getValue [line 90]

String getValue( )

Returns the current value of the element.

In case of the file input, the value contains the a filename, if a file has successfully been transferrred to the server. In any other case the value stays an empty string.




Tags:

return:  filename of uploaded file or empty string
access:  public


Overrides InputText::getValue() (Returns the current value of the element.)

[ Top ]

method setAccept [line 71]

InputFile setAccept( String $accept)

Sets the file-accept type of the element.

Be aware that no current browser actively uses this setting. Nonetheless it's part of the standard and could be used for information purposes for javascript e.g.




Tags:

return:  method owner
access:  public


Parameters:

String   $accept   html-accept-type for the element

[ Top ]


Documentation generated on Fri, 18 Jul 2014 16:31:58 +0200 by phpDocumentor 1.4.3