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

Class: HTML_QuickForm2_Element_InputFile

Source Location: /HTML_QuickForm2-2.1.0/HTML/QuickForm2/Element/InputFile.php

Class Overview

HTML_Common2
   |
   --HTML_QuickForm2_Node
      |
      --HTML_QuickForm2_Element
         |
         --HTML_QuickForm2_Element_Input
            |
            --HTML_QuickForm2_Element_InputFile

Class for <input type="file" /> elements


Author(s):

Version:

  • Release: 2.1.0

Variables

Methods


Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Element_Input

HTML_QuickForm2_Element_Input::getFrozenHtml()
Returns the field's value without HTML tags
HTML_QuickForm2_Element_Input::getRawValue()
HTML_QuickForm2_Element_Input::getType()
HTML_QuickForm2_Element_Input::onAttributeChange()
HTML_QuickForm2_Element_Input::setValue()
HTML_QuickForm2_Element_Input::__toString()

Class: HTML_QuickForm2_Element

HTML_QuickForm2_Element::applyFilters()
Applies recursive and non-recursive filters on element value
HTML_QuickForm2_Element::getJavascriptTriggers()
HTML_QuickForm2_Element::getJavascriptValue()
Returns Javascript code for getting the element's value
HTML_QuickForm2_Element::getPersistentContent()
Generates hidden form field containing the element's value
HTML_QuickForm2_Element::render()
Renders the element using the given renderer
HTML_QuickForm2_Element::setName()
HTML_QuickForm2_Element::updateValue()
Called when the element needs to update its value from form's data sources

Class: HTML_QuickForm2_Node

HTML_QuickForm2_Node::__construct()
Class constructor
HTML_QuickForm2_Node::addFilter()
Adds a filter
HTML_QuickForm2_Node::addRecursiveFilter()
Adds a recursive filter
HTML_QuickForm2_Node::addRule()
Adds a validation rule
HTML_QuickForm2_Node::applyFilter()
Helper function for applying filter callback to a value
HTML_QuickForm2_Node::applyFilters()
Applies non-recursive filters on element value
HTML_QuickForm2_Node::createRule()
Creates a validation rule
HTML_QuickForm2_Node::generateId()
Generates an id for the element
HTML_QuickForm2_Node::getContainer()
Returns the element containing current
HTML_QuickForm2_Node::getData()
Returns the element options
HTML_QuickForm2_Node::getDataSources()
Returns the data sources for this element
HTML_QuickForm2_Node::getError()
Returns the error message for the element
HTML_QuickForm2_Node::getId()
Returns the element's id
HTML_QuickForm2_Node::getJavascriptTriggers()
Returns IDs of form fields that should trigger "live" Javascript validation
HTML_QuickForm2_Node::getJavascriptValue()
Returns Javascript code for getting the element's value
HTML_QuickForm2_Node::getLabel()
Returns the element's label(s)
HTML_QuickForm2_Node::getName()
Returns the element's name
HTML_QuickForm2_Node::getRawValue()
Returns the element's value without filters applied
HTML_QuickForm2_Node::getType()
Returns the element's type
HTML_QuickForm2_Node::getValue()
Returns the element's value, possibly with filters applied
HTML_QuickForm2_Node::isRequired()
Checks whether an element is required
HTML_QuickForm2_Node::onAttributeChange()
Intercepts setting 'name' and 'id' attributes
HTML_QuickForm2_Node::persistentFreeze()
Changes the element's persistent freeze behaviour
HTML_QuickForm2_Node::removeRule()
Removes a validation rule
HTML_QuickForm2_Node::render()
Renders the element using the given renderer
HTML_QuickForm2_Node::renderClientRules()
Adds element's client-side validation rules to a builder object
HTML_QuickForm2_Node::setContainer()
Adds the link to the element containing current
HTML_QuickForm2_Node::setError()
Sets the error message to the element
HTML_QuickForm2_Node::setId()
Sets the element's id
HTML_QuickForm2_Node::setLabel()
Sets the element's label(s)
HTML_QuickForm2_Node::setName()
Sets the element's name
HTML_QuickForm2_Node::setValue()
Sets the element's value
HTML_QuickForm2_Node::storeId()
Stores the explicitly given id to prevent duplicate id generation
HTML_QuickForm2_Node::toggleFrozen()
Changes the element's frozen status
HTML_QuickForm2_Node::updateValue()
Called when the element needs to update its value from form's data sources
HTML_QuickForm2_Node::validate()
Performs the server-side validation

Class Details

[line 38]
Class for <input type="file" /> elements


[ Top ]


Class Variables

$attributes = array('type' => 'file')

[line 52]

  • Access: protected

Type:   mixed


[ Top ]

$language =  null

[line 44]

Language to display error messages in
  • Access: protected

Type:   string


[ Top ]

$messageProvider =

[line 58]

Message provider for upload error messages
  • Access: protected

Type:   callback|HTML_QuickForm2_MessageProvider


[ Top ]

$value =  null

[line 50]

Information on uploaded file, from submit data source
  • Access: protected

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 75]

HTML_QuickForm2_Element_InputFile __construct( [string $name = null], [string|array $attributes = null], [array $data = array()])

Class constructor

Possible keys in $data array are:

  • 'messageProvider': an instance of a class implementing HTML_QuickForm2_MessageProvider interface, this will be used to get localized error messages. Default will be used if not given.
  • 'language': language to display error messages in, will be passed to message provider.

  • Access: public

Overrides HTML_QuickForm2_Node::__construct() (Class constructor)

Parameters:

string   $name   —  Element name
string|array   $attributes   —  Attributes (either a string or an array)
array   $data   —  Data used to set up error messages for PHP's file upload errors.

[ Top ]

addFilter   [line 227]

void addFilter( $callback, [array $options = array()])

  • Access: public

Overrides HTML_QuickForm2_Node::addFilter() (Adds a filter)

Parameters:

   $callback   — 
array   $options   — 

[ Top ]

addRecursiveFilter   [line 234]

void addRecursiveFilter( $callback, [array $options = array()])

  • Access: public

Overrides HTML_QuickForm2_Node::addRecursiveFilter() (Adds a recursive filter)

Parameters:

   $callback   — 
array   $options   — 

[ Top ]

getRawValue   [line 122]

array|null getRawValue( )

Returns the information on uploaded file
  • Access: public

Overrides HTML_QuickForm2_Element_Input::getRawValue() (parent method not documented)
[ Top ]

getValue   [line 132]

array|null getValue( )

Alias of getRawValue(), InputFile elements do not allow filters
  • Access: public

Overrides HTML_QuickForm2_Node::getValue() (Returns the element's value, possibly with filters applied)
[ Top ]

setValue   [line 144]

$this setValue( mixed $value)

File upload's value cannot be set here
  • Access: public

Overrides HTML_QuickForm2_Element_Input::setValue() (parent method not documented)

Parameters:

mixed   $value   —  Value for file element, this parameter is ignored

[ Top ]

toggleFrozen   [line 112]

bool toggleFrozen( [bool $freeze = null])

File upload elements cannot be frozen

To properly "freeze" a file upload element one has to store the uploaded file somewhere and store the file info in session. This is way outside the scope of this class.

  • Return: Always returns false
  • Access: public

Overrides HTML_QuickForm2_Node::toggleFrozen() (Changes the element's frozen status)

Parameters:

bool   $freeze   —  Whether element should be frozen or editable. This parameter is ignored in case of file uploads

[ Top ]

updateValue   [line 149]

void updateValue( )

  • Access: protected

Overrides HTML_QuickForm2_Element::updateValue() (Called when the element needs to update its value from form's data sources)
[ Top ]

validate   [line 193]

boolean validate( )

Performs the server-side validation

Before the Rules added to the element kick in, the element checks the error code added to the $_FILES array by PHP. If the code isn't UPLOAD_ERR_OK or UPLOAD_ERR_NO_FILE then a built-in error message will be displayed and no further validation will take place.

  • Return: Whether the element is valid
  • Access: protected

Overrides HTML_QuickForm2_Node::validate() (Performs the server-side validation)
[ Top ]


Documentation generated on Wed, 10 Apr 2019 08:56:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.