Form
extends Element
in package
Uses
AttributeClassTrait, AttributeDataTrait, AttributeAutocompleteTrait
This is the Form element class.
This class encapsulates the gets/sets of the attributes and events of a 'form'.
This class extends Element (FWK\Core\Form\Elements\Element), see this class.
Tags
Table of Contents
METHOD_GET | Form method, option 'get'. | = 'get' |
---|---|---|
METHOD_POST | Form method, option 'post'. | = 'post' |
TARGET_BLANK | Form target, option '_blank'. | = '_blank' |
TARGET_PARENT | Form target, option '_parent'. | = '_parent' |
TARGET_SELF | Form target, option '_self'. | = '_self' |
TARGET_TOP | Form target, option '_top'. | = '_top' |
TYPE | = 'form' | |
$acceptCharset | : string | |
$action | : string | |
$attributeWildcard | : string | |
$autocomplete | : string | |
$class | : string | |
$classRichFormFactory | : string|null | |
$data | : mixed | |
$elements | : mixed | |
$elementsClass | : array<string|int, mixed> | |
$enctype | : string | |
$id | : string | |
$method | : string | |
$name | : string | |
$novalidate | : bool | |
$onblur | : string | |
$onchange | : string | |
$oncontextmenu | : string | |
$onfocus | : string | |
$oninput | : string | |
$oninvalid | : string | |
$onreset | : string | |
$onsearch | : string | |
$onselect | : string | |
$onsubmit | : string | |
$target | : string | |
$uId | : string | |
__construct() | Constructor. | : mixed |
getAcceptCharset() | This method returns the 'accept-charset' form attribute. | : string |
getAction() | This method returns the 'action' form attribute. | : string |
getAttributeWildcard() | This method returns the current value of the 'wildcard' attribute. | : string |
getAutocomplete() | This method returns the current value of the 'autocomplete' attribute. | : string |
getClass() | This method returns the current value of the 'class' attribute. | : string |
getData() | This method returns the current value of the 'data' attribute. | : string |
getEnctype() | This method returns the 'enctype' form attribute. | : string |
getFilterInput() | This method returns the FilterInput of the Element. | : FilterInput|null |
getId() | This method returns the 'id' attribute of the form. | : string |
getMethod() | This method returns the 'method' form attribute. | : string |
getName() | This method returns the 'name' form attribute. | : string |
getNovalidate() | This method returns the 'novalidate' form attribute. | : bool |
getOnblur() | This method returns the 'onblur' event current value. | : string |
getOnchange() | This method returns the 'onchange' event current value. | : string |
getOncontextmenu() | This method returns the 'oncontextmenu' event current value. | : string |
getOnfocus() | This method returns the 'onfocus' event current value. | : string |
getOninput() | This method returns the 'oninput' event current value. | : string |
getOninvalid() | This method returns the 'oninvalid' event current value. | : string |
getOnreset() | This method returns the 'onreset' event current value. | : string |
getOnsearch() | This method returns the 'onsearch' event current value. | : string |
getOnselect() | This method returns the 'onselect' event current value. | : string |
getOnsubmit() | This method returns the 'onsubmit' event current value. | : string |
getTarget() | This method returns the 'target' form attribute. | : string |
getType() | This method returns the type of the Element. | : string |
getUId() | This method returns the 'Unique Identifier' of the form. | : string |
outputElement() | This method returns the html output tag of the Element with the name given by parameter. | : string |
setAcceptCharset() | This method sets the 'accept-charset' form attribute: specifies the charset used in the submitted form. | : Form |
setAttributeWildcard() | This method sets the 'wildcard' attribute with the given value and returns self. | : self |
setAutocomplete() | This method sets the 'autocomplete' attribute with the given value and returns self. | : self |
setClass() | This method sets the 'class' attribute with the given value and returns self. | : self |
setData() | This method sets the 'data' attribute with the given value and returns self. | : self |
setEnctype() | This method sets the 'enctype' form attribute: the encoding of the submitted data (default: is url-encoded). | : Form |
setFilterInput() | This method sets the FilterInput of the Element and returns self. | : self |
setId() | This method sets the 'id' form attribute. | : Form |
setMethod() | This method sets the 'method' form attribute: specifies the HTTP method used when submitting the form (default: Form::METHOD_GET). | : Form |
setNovalidate() | This method sets the 'novalidate' form attribute: specifies if the browser should not validate the form. | : Form |
setOnblur() | This method sets the 'onblur' event. | : Form |
setOnchange() | This method sets the 'onchange' event. | : Form |
setOncontextmenu() | This method sets the 'oncontextmenu' event. | : Form |
setOnfocus() | This method sets the 'onfocus' event. | : Form |
setOninput() | This method sets the 'oninput' event. | : Form |
setOninvalid() | This method sets the 'oninvalid' event. | : Form |
setOnreset() | This method sets the 'onreset' event. | : Form |
setOnsearch() | This method sets the 'onsearch' event. | : Form |
setOnselect() | This method sets the 'onselect' event. | : Form |
setOnsubmit() | This method sets the 'onsubmit' event. | : Form |
setTarget() | This method sets the 'target' form attribute: specifies the target of the address in the action attribute (default: Form::TARGET_SELF). | : Form |
setUId() | This method sets the given Unique identifier to the form. | : Form |
getRichFormFactory() | : string | |
outputAttributes() | This method outputs the attributes (html) of the Element. | : string |
Constants
METHOD_GET
Form method, option 'get'.
public
mixed
METHOD_GET
= 'get'
METHOD_POST
Form method, option 'post'.
public
mixed
METHOD_POST
= 'post'
TARGET_BLANK
Form target, option '_blank'.
public
mixed
TARGET_BLANK
= '_blank'
TARGET_PARENT
Form target, option '_parent'.
public
mixed
TARGET_PARENT
= '_parent'
TARGET_SELF
Form target, option '_self'.
public
mixed
TARGET_SELF
= '_self'
TARGET_TOP
Form target, option '_top'.
public
mixed
TARGET_TOP
= '_top'
TYPE
public
mixed
TYPE
= 'form'
Properties
$acceptCharset
protected
string
$acceptCharset
= ''
$action
protected
string
$action
= ''
$attributeWildcard
protected
string
$attributeWildcard
= ''
$autocomplete
protected
string
$autocomplete
= \FWK\Core\Form\Elements\Input::AUTOCOMPLETE_OFF
$class
protected
string
$class
= ''
$classRichFormFactory
protected
static string|null
$classRichFormFactory
= null
$data
protected
mixed
$data
= null
$elements
protected
static mixed
$elements
= null
$elementsClass
protected
static array<string|int, mixed>
$elementsClass
= []
$enctype
protected
string
$enctype
= ''
$id
protected
string
$id
= ''
$method
protected
string
$method
= ''
$name
protected
string
$name
= ''
$novalidate
protected
bool
$novalidate
= false
$onblur
protected
string
$onblur
= ''
$onchange
protected
string
$onchange
= ''
$oncontextmenu
protected
string
$oncontextmenu
= ''
$onfocus
protected
string
$onfocus
= ''
$oninput
protected
string
$oninput
= ''
$oninvalid
protected
string
$oninvalid
= ''
$onreset
protected
string
$onreset
= ''
$onsearch
protected
string
$onsearch
= ''
$onselect
protected
string
$onselect
= ''
$onsubmit
protected
string
$onsubmit
= ''
$target
protected
string
$target
= ''
$uId
protected
string
$uId
= ''
Methods
__construct()
Constructor.
public
__construct(string $action, string $name) : mixed
Parameters
- $action : string
-
Specifies an address (url) where to submit the form (default: the submitting page).
- $name : string
-
Specifies a name used to identify the form (for DOM usage: document.forms.name).
Return values
mixed —getAcceptCharset()
This method returns the 'accept-charset' form attribute.
public
getAcceptCharset() : string
Return values
string —getAction()
This method returns the 'action' form attribute.
public
getAction() : string
Return values
string —getAttributeWildcard()
This method returns the current value of the 'wildcard' attribute.
public
getAttributeWildcard() : string
Return values
string —getAutocomplete()
This method returns the current value of the 'autocomplete' attribute.
public
getAutocomplete() : string
Return values
string —getClass()
This method returns the current value of the 'class' attribute.
public
getClass() : string
Return values
string —getData()
This method returns the current value of the 'data' attribute.
public
getData() : string
Return values
string —getEnctype()
This method returns the 'enctype' form attribute.
public
getEnctype() : string
Return values
string —getFilterInput()
This method returns the FilterInput of the Element.
public
getFilterInput() : FilterInput|null
Return values
FilterInput|null —getId()
This method returns the 'id' attribute of the form.
public
getId() : string
Return values
string —getMethod()
This method returns the 'method' form attribute.
public
getMethod() : string
Return values
string —getName()
This method returns the 'name' form attribute.
public
getName() : string
Return values
string —getNovalidate()
This method returns the 'novalidate' form attribute.
public
getNovalidate() : bool
Return values
bool —getOnblur()
This method returns the 'onblur' event current value.
public
getOnblur() : string
Return values
string —getOnchange()
This method returns the 'onchange' event current value.
public
getOnchange() : string
Return values
string —getOncontextmenu()
This method returns the 'oncontextmenu' event current value.
public
getOncontextmenu() : string
Return values
string —getOnfocus()
This method returns the 'onfocus' event current value.
public
getOnfocus() : string
Return values
string —getOninput()
This method returns the 'oninput' event current value.
public
getOninput() : string
Return values
string —getOninvalid()
This method returns the 'oninvalid' event current value.
public
getOninvalid() : string
Return values
string —getOnreset()
This method returns the 'onreset' event current value.
public
getOnreset() : string
Return values
string —getOnsearch()
This method returns the 'onsearch' event current value.
public
getOnsearch() : string
Return values
string —getOnselect()
This method returns the 'onselect' event current value.
public
getOnselect() : string
Return values
string —getOnsubmit()
This method returns the 'onsubmit' event current value.
public
getOnsubmit() : string
Return values
string —getTarget()
This method returns the 'target' form attribute.
public
getTarget() : string
Return values
string —getType()
This method returns the type of the Element.
public
getType() : string
Return values
string —getUId()
This method returns the 'Unique Identifier' of the form.
public
getUId() : string
Return values
string —outputElement()
This method returns the html output tag of the Element with the name given by parameter.
public
outputElement([string $name = '' ][, array<string|int, mixed> $richFormList = [] ]) : string
Parameters
- $name : string = ''
- $richFormList : array<string|int, mixed> = []
Tags
Return values
string —setAcceptCharset()
This method sets the 'accept-charset' form attribute: specifies the charset used in the submitted form.
public
setAcceptCharset(string $acceptCharse) : Form
Parameters
- $acceptCharse : string
Return values
Form —setAttributeWildcard()
This method sets the 'wildcard' attribute with the given value and returns self.
public
setAttributeWildcard(string $attributeWildcard) : self
Parameters
- $attributeWildcard : string
Return values
self —setAutocomplete()
This method sets the 'autocomplete' attribute with the given value and returns self.
public
setAutocomplete(string $autocomplete) : self
Parameters
- $autocomplete : string
-
Valid values: Input::AUTOCOMPLETE_ON, Input::AUTOCOMPLETE_OFF
Return values
self —setClass()
This method sets the 'class' attribute with the given value and returns self.
public
setClass(string $class) : self
Parameters
- $class : string
Return values
self —setData()
This method sets the 'data' attribute with the given value and returns self.
public
setData(mixed $data) : self
Parameters
- $data : mixed
Return values
self —setEnctype()
This method sets the 'enctype' form attribute: the encoding of the submitted data (default: is url-encoded).
public
setEnctype(string $enctype) : Form
Parameters
- $enctype : string
Return values
Form —setFilterInput()
This method sets the FilterInput of the Element and returns self.
public
setFilterInput([FilterInput $filterInput = null ]) : self
Parameters
- $filterInput : FilterInput = null
Return values
self —setId()
This method sets the 'id' form attribute.
public
setId(string $id) : Form
Parameters
- $id : string
Return values
Form —setMethod()
This method sets the 'method' form attribute: specifies the HTTP method used when submitting the form (default: Form::METHOD_GET).
public
setMethod(string $method) : Form
Possible values:
- Form::METHOD_GET
- Form::METHOD_POST
Parameters
- $method : string
Return values
Form —setNovalidate()
This method sets the 'novalidate' form attribute: specifies if the browser should not validate the form.
public
setNovalidate(bool $novalidate) : Form
Parameters
- $novalidate : bool
Return values
Form —setOnblur()
This method sets the 'onblur' event.
public
setOnblur(string $onblur) : Form
Parameters
- $onblur : string
Return values
Form —setOnchange()
This method sets the 'onchange' event.
public
setOnchange(string $onchange) : Form
Parameters
- $onchange : string
Return values
Form —setOncontextmenu()
This method sets the 'oncontextmenu' event.
public
setOncontextmenu(string $oncontextmenu) : Form
Parameters
- $oncontextmenu : string
Return values
Form —setOnfocus()
This method sets the 'onfocus' event.
public
setOnfocus(string $onfocus) : Form
Parameters
- $onfocus : string
Return values
Form —setOninput()
This method sets the 'oninput' event.
public
setOninput(string $oninput) : Form
Parameters
- $oninput : string
Return values
Form —setOninvalid()
This method sets the 'oninvalid' event.
public
setOninvalid(string $oninvalid) : Form
Parameters
- $oninvalid : string
Return values
Form —setOnreset()
This method sets the 'onreset' event.
public
setOnreset(string $onreset) : Form
Parameters
- $onreset : string
Return values
Form —setOnsearch()
This method sets the 'onsearch' event.
public
setOnsearch(string $onsearch) : Form
Parameters
- $onsearch : string
Return values
Form —setOnselect()
This method sets the 'onselect' event.
public
setOnselect(string $onselect) : Form
Parameters
- $onselect : string
Return values
Form —setOnsubmit()
This method sets the 'onsubmit' event.
public
setOnsubmit(string $onsubmit) : Form
Parameters
- $onsubmit : string
Return values
Form —setTarget()
This method sets the 'target' form attribute: specifies the target of the address in the action attribute (default: Form::TARGET_SELF).
public
setTarget(string $target) : Form
Possible values:
- Form::TARGET_SELF
- Form::TARGET_BLANK
- Form::TARGET_PARENT
- Form::TARGET_TOP
Parameters
- $target : string
Return values
Form —setUId()
This method sets the given Unique identifier to the form.
public
setUId(string $uId) : Form
Parameters
- $uId : string
Return values
Form —getRichFormFactory()
protected
static getRichFormFactory() : string
Return values
string —outputAttributes()
This method outputs the attributes (html) of the Element.
protected
outputAttributes(string $name[, array<string|int, mixed> $richFormList = [] ]) : string
Parameters
- $name : string
- $richFormList : array<string|int, mixed> = []