Class: HTML_QuickForm
Source Location: /pear/HTML/QuickForm.php
HTML_Common
|
--HTML_QuickForm
Create, validate and process HTML forms
Author(s):
Version:
|
|
|
Class Details
Class Variables
Class Methods
constructor HTML_QuickForm [line 258]
HTML_QuickForm HTML_QuickForm(
[string
$formName = ''], [string
$method = 'post'], [string
$action = ''], [string
$target = ''], [mixed
$attributes = null], [bool
$trackSubmit = false])
|
|
Class constructor
Tags:
Parameters:
method accept [line 1636]
void accept(
object An
&$renderer)
|
|
Accepts a renderer
Tags:
Parameters:
method addElement [line 597]
object reference &addElement(
mixed
$element)
|
|
Adds an element into the form If $element is a string representing element type, then this method accepts variable number of parameters, their meaning and count depending on $element
Tags:
Parameters:
method addFormRule [line 1185]
void addFormRule(
mixed
$rule)
|
|
Adds a global validation rule This should be used when for a rule involving several fields or if you want to use some completely custom validation for your form. The rule function/method should return true in case of successful validation and array('element name' => 'error') when there were errors.
Tags:
Parameters:
method addGroup [line 719]
object reference &addGroup(
array
$elements, [string
$name = null], [string
$groupLabel = ''], [string
$separator = null], [string
$appendName = true])
|
|
Adds an element group
Tags:
Parameters:
method addGroupRule [line 1095]
void addGroupRule(
string
$group, mixed
$arg1, [string
$type = ''], [string
$format = null], [int
$howmany = 0], [string
$validation = 'server'], [bool
$reset = false])
|
|
Adds a validation rule for the given group of elements Only groups with a name can be assigned a validation rule Use addGroupRule when you need to validate elements inside the group. Use addRule if you need to validate the group as a whole. In this case, the same rule will be applied to all elements in the group. Use addRule if you need to validate the group against a function.
Tags:
Parameters:
method addRule [line 1029]
void addRule(
string
$element, string
$message, string
$type, [string
$format = null], [string
$validation = 'server'], [boolean
$reset = false], [boolean
$force = false])
|
|
Adds a validation rule for the given field If the element is in fact a group, it will be considered as a whole. To validate grouped elements as separated entities, use addGroupRule instead of addRule.
Tags:
Parameters:
method apiVersion [line 316]
method applyFilter [line 1204]
void applyFilter(
mixed
$element, mixed
$filter)
|
|
Applies a data filter for the given field(s)
Tags:
Parameters:
method arrayMerge [line 1272]
array arrayMerge(
array
$a, array
$b)
|
|
Merges two arrays Merges two array like the PHP function array_merge but recursively. The main difference is that existing keys will not be renumbered if they are integers.
Tags:
Parameters:
method createElement [line 537]
object extended &createElement(
string
$elementType)
|
|
Creates a new form element of the given type. This method accepts variable number of parameters, their meaning and count depending on $elementType
Tags:
Parameters:
method defaultRenderer [line 1659]
object a &defaultRenderer(
)
|
|
Returns a reference to default renderer object
Tags:
method elementExists [line 371]
boolean elementExists(
[string
$element = null])
|
|
Returns true if element is in the form
Tags:
Parameters:
method errorMessage [line 1943]
string errorMessage(
int
$value)
|
|
Return a textual error message for an QuickForm error code
Tags:
Parameters:
method exportValue [line 1839]
mixed exportValue(
string
$element)
|
|
Returns a 'safe' element's value This method first tries to find a cleaned-up submitted value, it will return a value set by setValue()/setDefaults()/setConstants() if submitted value does not exist for the given element.
Tags:
Parameters:
method exportValues [line 1873]
array exportValues(
[mixed
$elementList = null])
|
|
Returns 'safe' elements' values Unlike getSubmitValues(), this will return only the values corresponding to the elements present in the form.
Tags:
Parameters:
method freeze [line 1563]
void freeze(
[mixed
$elementList = null])
|
|
Displays elements without HTML input tags
Tags:
Parameters:
method getElement [line 743]
object reference &getElement(
string
$element)
|
|
Returns a reference to the element
Tags:
Parameters:
method getElementError [line 894]
string getElementError(
string
$element)
|
|
Returns error corresponding to validated element
Tags:
Parameters:
method getElementType [line 933]
string getElementType(
string
$element)
|
|
Returns the type of the given element
Tags:
Parameters:
method getElementValue [line 768]
mixed &getElementValue(
string
$element)
|
|
Returns the element's raw value This returns the value as submitted by the form (not filtered) or set via setDefaults() or setConstants()
Tags:
Parameters:
method getMaxFileSize [line 517]
Returns the value of MAX_FILE_SIZE hidden element
Tags:
method getRegisteredRules [line 1372]
array getRegisteredRules(
)
|
|
Returns an array of registered validation rules
Tags:
method getRegisteredTypes [line 1317]
array getRegisteredTypes(
)
|
|
Returns an array of registered element types
Tags:
method getRequiredNote [line 1456]
string getRequiredNote(
)
|
|
Returns the required note
Tags:
method getSubmitValue [line 800]
mixed getSubmitValue(
string
$elementName)
|
|
Returns the elements value after submit and filter
Tags:
Parameters:
method getSubmitValues [line 1799]
array getSubmitValues(
[bool
$mergeFiles = false])
|
|
Returns the values submitted by the form
Tags:
Parameters:
method getValidationScript [line 1701]
string getValidationScript(
)
|
|
Returns the client side validation script
Tags:
method insertElementBefore [line 652]
Inserts a new element right before the other element Warning: it is not possible to check whether the $element is already added to the form, therefore if you want to move the existing form element to a new position, you'll have to use removeElement(): $form->insertElementBefore($form->removeElement('foo', false), 'bar');
Tags:
Parameters:
method isElementFrozen [line 1404]
boolean isElementFrozen(
string
$element)
|
|
Returns whether or not the form element is frozen
Tags:
Parameters:
method isElementRequired [line 1388]
boolean isElementRequired(
string
$element)
|
|
Returns whether or not the form element is required
Tags:
Parameters:
method isError [line 1928]
bool isError(
mixed
$value)
|
|
Tell whether a result from a QuickForm method is an error (an instance of HTML_QuickForm_Error)
Tags:
Parameters:
method isFrozen [line 1599]
Returns whether or not the whole form is frozen
Tags:
method isRuleRegistered [line 1334]
mixed isRuleRegistered(
string
$name, [bool
$autoRegister = false])
|
|
Returns whether or not the given rule is supported
Tags:
Parameters:
method isSubmitted [line 1912]
Tells whether the form was already submitted This is useful since the _submitFiles and _submitValues arrays may be completely empty after the trackSubmit value is removed.
Tags:
method isTypeRegistered [line 1302]
boolean isTypeRegistered(
string
$type)
|
|
Returns whether or not the form element type is supported
Tags:
Parameters:
method process [line 1616]
void process(
mixed
$callback, [bool
$mergeFiles = true])
|
|
Performs the form data processing
Tags:
Parameters:
method registerElementType [line 334]
void registerElementType(
string
$typeName, string
$include, string
$className)
|
|
Registers a new element type
Tags:
Parameters:
method registerRule [line 353]
void registerRule(
string
$ruleName, string
$type, string
$data1, [string
$data2 = null])
|
|
Registers a new validation rule
Tags:
Parameters:
method removeElement [line 989]
Removes an element The method "unlinks" an element from the form, returning the reference to the element object. If several elements named $elementName exist, it removes the first one, leaving the others intact.
Tags:
Parameters:
method setConstants [line 458]
void setConstants(
[array
$constantValues = null], [mixed
$filter = null])
|
|
Initializes constant form values. These values won't get overridden by POST or GET vars
Tags:
Parameters:
method setDatasource [line 392]
void setDatasource(
&$datasource, [mixed
$defaultsFilter = null], [mixed
$constantsFilter = null], object
$datasource)
|
|
Sets a datasource object for this form object Datasource default and constant values will feed the QuickForm object if the datasource implements defaultValues() and constantValues() methods.
Tags:
Parameters:
method setDefaults [line 419]
void setDefaults(
[array
$defaultValues = null], [mixed
$filter = null])
|
|
Initializes default form values
Tags:
Parameters:
method setElementError [line 913]
void setElementError(
string
$element, [string
$message = null])
|
|
Set error message for a form element
Tags:
Parameters:
method setJsWarnings [line 1424]
void setJsWarnings(
string
$pref, string
$post)
|
|
Sets JavaScript warning messages
Tags:
Parameters:
method setMaxFileSize [line 494]
void setMaxFileSize(
[int
$bytes = 0])
|
|
Sets the value of MAX_FILE_SIZE hidden element
Tags:
Parameters:
method setRequiredNote [line 1441]
void setRequiredNote(
string
$note)
|
|
Sets required-note
Tags:
Parameters:
method toArray [line 1817]
array toArray(
[bool
$collectHidden = false])
|
|
Returns the form's contents in an array. The description of the array structure is in HTML_QuickForm_Renderer_Array docs
Tags:
Parameters:
method toHtml [line 1681]
string toHtml(
[string
$in_data = null])
|
|
Returns an HTML version of the form
Tags:
Overrides HTML_Common::toHtml() (Abstract method. Must be extended to return the objects HTML)
Parameters:
method updateElementAttr [line 953]
void updateElementAttr(
mixed
$elements, mixed
$attrs)
|
|
Updates Attributes for one or more elements
Tags:
Parameters:
method validate [line 1470]
Performs the server side validation
Tags:
method _reindexFiles [line 870]
array _reindexFiles(
mixed
$value, string
$key)
|
|
A helper function to change the indexes in $_FILES array
Parameters:
|
|