PHP Class Nette\Forms\Form

Author: David Grudl
Inheritance: extends Container
Afficher le fichier Open project: nette/forms Class Usage Examples

Méthodes publiques

Свойство Type Description
$httpRequest used only by standalone form
$onError function (Form $sender); Occurs when the form is submitted and is not valid
$onRender function (Form $sender); Occurs before the form is rendered
$onSubmit function (Form $sender); Occurs when the form is submitted
$onSuccess function (Form $sender); Occurs when the form is submitted and successfully validated

Méthodes publiques

Méthode Description
__construct ( $name = NULL ) Form constructor.
__toString ( ) : string Renders form to string.
addError ( $message ) : void Adds global error message.
addGroup ( $caption = NULL, $setAsCurrent = TRUE ) : ControlGroup Adds fieldset group to the form.
addProtection ( $message = NULL ) : CsrfProtection Cross-Site Request Forgery (CSRF) form protection.
cleanErrors ( ) : void
fireEvents ( ) : void Fires submit/click events.
fireRenderEvents ( ) : void Must be called before form is rendered and render() is not used.
getAction ( ) : mixed Returns form's action.
getElementPrototype ( ) : Nette\Utils\Html Returns form's HTML element template.
getErrors ( ) : array Returns global validation errors.
getForm ( $need = TRUE ) : self Returns self.
getGroup ( $name ) : ControlGroup Returns the specified group.
getGroups ( ) : ControlGroup[] Returns all defined groups.
getHttpData ( $type = NULL, $htmlName = NULL ) : mixed Returns submitted HTTP data.
getMethod ( ) : string Returns form's method.
getOwnErrors ( ) : array Returns form's validation errors.
getRenderer ( ) : Nette\Forms\IFormRenderer Returns form renderer.
getToggles ( ) : array
getTranslator ( ) : Nette\Localization\ITranslator | null Returns translate adapter.
hasErrors ( ) : boolean
isAnchored ( ) : boolean Tells if the form is anchored.
isMethod ( $method ) : boolean Checks if the request method is the given one.
isSubmitted ( ) : Nette\Forms\ISubmitterControl | FALSE Tells if the form was submitted.
isSuccess ( ) : boolean Tells if the form was submitted and successfully validated.
removeGroup ( $name ) : void Removes fieldset group from form.
render ( $args ) : void Renders form.
setAction ( $url ) : self Sets form's action.
setMethod ( $method ) : self Sets form's method.
setRenderer ( Nette\Forms\IFormRenderer $renderer = NULL ) : self Sets form renderer.
setSubmittedBy ( Nette\Forms\ISubmitterControl $by = NULL ) : self Sets the submittor control.
setTranslator ( Nette\Localization\ITranslator $translator = NULL ) : self Sets translate adapter.
validate ( array $controls = NULL ) ******************* validation ****************d*g*
validateMaxPostSize ( )

Méthodes protégées

Méthode Description
attached ( $obj ) : void This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
beforeRender ( ) : void
receiveHttpData ( ) : array | null Internal: returns submitted HTTP data or NULL when form was not submitted.
validateParent ( Nette\ComponentModel\IContainer $parent ) : void

Private Methods

Méthode Description
getHttpRequest ( ) : Nette\Http\IRequest

Method Details

__construct() public méthode

Form constructor.
public __construct ( $name = NULL )

__toString() public méthode

Renders form to string.
public __toString ( ) : string
Résultat string

addError() public méthode

Adds global error message.
public addError ( $message ) : void
Résultat void

addGroup() public méthode

Adds fieldset group to the form.
public addGroup ( $caption = NULL, $setAsCurrent = TRUE ) : ControlGroup
Résultat ControlGroup

addProtection() public méthode

Cross-Site Request Forgery (CSRF) form protection.
public addProtection ( $message = NULL ) : CsrfProtection
Résultat Nette\Forms\Controls\CsrfProtection

attached() protected méthode

This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
protected attached ( $obj ) : void
Résultat void

beforeRender() protected méthode

protected beforeRender ( ) : void
Résultat void

cleanErrors() public méthode

public cleanErrors ( ) : void
Résultat void

fireEvents() public méthode

Fires submit/click events.
public fireEvents ( ) : void
Résultat void

fireRenderEvents() public méthode

Must be called before form is rendered and render() is not used.
public fireRenderEvents ( ) : void
Résultat void

getAction() public méthode

Returns form's action.
public getAction ( ) : mixed
Résultat mixed URI

getElementPrototype() public méthode

Returns form's HTML element template.
public getElementPrototype ( ) : Nette\Utils\Html
Résultat Nette\Utils\Html

getErrors() public méthode

Returns global validation errors.
public getErrors ( ) : array
Résultat array

getForm() public méthode

Returns self.
public getForm ( $need = TRUE ) : self
Résultat self

getGroup() public méthode

Returns the specified group.
public getGroup ( $name ) : ControlGroup
Résultat ControlGroup

getGroups() public méthode

Returns all defined groups.
public getGroups ( ) : ControlGroup[]
Résultat ControlGroup[]

getHttpData() public méthode

Returns submitted HTTP data.
public getHttpData ( $type = NULL, $htmlName = NULL ) : mixed
Résultat mixed

getMethod() public méthode

Returns form's method.
public getMethod ( ) : string
Résultat string get | post

getOwnErrors() public méthode

Returns form's validation errors.
public getOwnErrors ( ) : array
Résultat array

getRenderer() public méthode

Returns form renderer.
public getRenderer ( ) : Nette\Forms\IFormRenderer
Résultat Nette\Forms\IFormRenderer

getToggles() public méthode

public getToggles ( ) : array
Résultat array

getTranslator() public méthode

Returns translate adapter.
public getTranslator ( ) : Nette\Localization\ITranslator | null
Résultat Nette\Localization\ITranslator | null

hasErrors() public méthode

public hasErrors ( ) : boolean
Résultat boolean

isAnchored() public méthode

Tells if the form is anchored.
public isAnchored ( ) : boolean
Résultat boolean

isMethod() public méthode

Checks if the request method is the given one.
public isMethod ( $method ) : boolean
Résultat boolean

isSubmitted() public méthode

Tells if the form was submitted.
public isSubmitted ( ) : Nette\Forms\ISubmitterControl | FALSE
Résultat Nette\Forms\ISubmitterControl | FALSE submittor control

isSuccess() public méthode

Tells if the form was submitted and successfully validated.
public isSuccess ( ) : boolean
Résultat boolean

receiveHttpData() protected méthode

Internal: returns submitted HTTP data or NULL when form was not submitted.
protected receiveHttpData ( ) : array | null
Résultat array | null

removeGroup() public méthode

Removes fieldset group from form.
public removeGroup ( $name ) : void
Résultat void

render() public méthode

Renders form.
public render ( $args ) : void
Résultat void

setAction() public méthode

Sets form's action.
public setAction ( $url ) : self
Résultat self

setMethod() public méthode

Sets form's method.
public setMethod ( $method ) : self
Résultat self

setRenderer() public méthode

Sets form renderer.
public setRenderer ( Nette\Forms\IFormRenderer $renderer = NULL ) : self
$renderer Nette\Forms\IFormRenderer
Résultat self

setSubmittedBy() public méthode

Sets the submittor control.
public setSubmittedBy ( Nette\Forms\ISubmitterControl $by = NULL ) : self
$by Nette\Forms\ISubmitterControl
Résultat self

setTranslator() public méthode

Sets translate adapter.
public setTranslator ( Nette\Localization\ITranslator $translator = NULL ) : self
$translator Nette\Localization\ITranslator
Résultat self

validate() public méthode

******************* validation ****************d*g*
public validate ( array $controls = NULL )
$controls array

validateMaxPostSize() public méthode

public validateMaxPostSize ( )

validateParent() protected méthode

protected validateParent ( Nette\ComponentModel\IContainer $parent ) : void
$parent Nette\ComponentModel\IContainer
Résultat void

Property Details

$httpRequest public_oe property

used only by standalone form
public $httpRequest

$onError public_oe property

function (Form $sender); Occurs when the form is submitted and is not valid
public $onError

$onRender public_oe property

function (Form $sender); Occurs before the form is rendered
public $onRender

$onSubmit public_oe property

function (Form $sender); Occurs when the form is submitted
public $onSubmit

$onSuccess public_oe property

function (Form $sender); Occurs when the form is submitted and successfully validated
public $onSuccess