class Form extends Link implements ArrayAccess
Form represents an HTML form.
Methods
__construct(DOMElement $node, string $currentUri, string $method = null, string $baseHref = null) Constructor. | ||
DOMElement | getNode() Gets the node associated with this link. | from AbstractUriElement |
string | getMethod() Gets the form method. | |
string | getUri() Gets the URI of the form. | |
DOMElement | getFormNode() Gets the form node associated with this form. | |
Form | setValues(array $values) Sets the value of the fields. | |
array | getValues() Gets the field values. | |
array | getFiles() Gets the file field values. | |
array | getPhpValues() Gets the field values as PHP. | |
array | getPhpFiles() Gets the file field values as PHP. | |
bool | has(string $name) Returns true if the named field exists. | |
remove(string $name) Removes a field from the form. | ||
FormField | get(string $name) Gets a named field. | |
set(FormField $field) Sets a named field. | ||
FormField[] | all() Gets all fields. | |
bool | offsetExists(string $name) Returns true if the named field exists. | |
FormField | offsetGet(string $name) Gets the value of a field. | |
offsetSet(string $name, string|array $value) Sets the value of a field. | ||
offsetUnset(string $name) Removes a field from the form. | ||
Form | disableValidation() Disables validation. |
Details
__construct(DOMElement $node, string $currentUri, string $method = null, string $baseHref = null)
Constructor.
DOMElement getNode()
Gets the node associated with this link.
string getMethod()
Gets the form method.
If no method is defined in the form, GET is returned.
string getUri()
Gets the URI of the form.
The returned URI is not the same as the form "action" attribute. This method merges the value if the method is GET to mimics browser behavior.
DOMElement getFormNode()
Gets the form node associated with this form.
Form setValues(array $values)
Sets the value of the fields.
array getValues()
Gets the field values.
The returned array does not include file fields (see getFiles).
array getFiles()
Gets the file field values.
array getPhpValues()
Gets the field values as PHP.
This method converts fields with the array notation (like foo[bar] to arrays) like PHP does.
array getPhpFiles()
Gets the file field values as PHP.
This method converts fields with the array notation (like foo[bar] to arrays) like PHP does. The returned array is consistent with the array for field values (see getPhpValues), rather than uploaded files found in $FILES. For a compound file field foo[bar] it will create foo[bar][name], instead of foo[name][bar] which would be found in $FILES.
bool has(string $name)
Returns true if the named field exists.
remove(string $name)
Removes a field from the form.
FormField get(string $name)
Gets a named field.
set(FormField $field)
Sets a named field.
FormField[] all()
Gets all fields.
bool offsetExists(string $name)
Returns true if the named field exists.
FormField offsetGet(string $name)
Gets the value of a field.
offsetSet(string $name, string|array $value)
Sets the value of a field.
offsetUnset(string $name)
Removes a field from the form.
Form disableValidation()
Disables validation.
Please login to continue.