PHP Класс Nette\Forms\Form

Автор: David Grudl
Наследование: extends Container
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
__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 ( )

Защищенные методы

Метод Описание
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

Приватные методы

Метод Описание
getHttpRequest ( ) : Nette\Http\IRequest

Описание методов

__construct() публичный Метод

Form constructor.
public __construct ( $name = NULL )

__toString() публичный Метод

Renders form to string.
public __toString ( ) : string
Результат string

addError() публичный Метод

Adds global error message.
public addError ( $message ) : void
Результат void

addGroup() публичный Метод

Adds fieldset group to the form.
public addGroup ( $caption = NULL, $setAsCurrent = TRUE ) : ControlGroup
Результат ControlGroup

addProtection() публичный Метод

Cross-Site Request Forgery (CSRF) form protection.
public addProtection ( $message = NULL ) : CsrfProtection
Результат Nette\Forms\Controls\CsrfProtection

attached() защищенный Метод

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
Результат void

beforeRender() защищенный Метод

protected beforeRender ( ) : void
Результат void

cleanErrors() публичный Метод

public cleanErrors ( ) : void
Результат void

fireEvents() публичный Метод

Fires submit/click events.
public fireEvents ( ) : void
Результат void

fireRenderEvents() публичный Метод

Must be called before form is rendered and render() is not used.
public fireRenderEvents ( ) : void
Результат void

getAction() публичный Метод

Returns form's action.
public getAction ( ) : mixed
Результат mixed URI

getElementPrototype() публичный Метод

Returns form's HTML element template.
public getElementPrototype ( ) : Nette\Utils\Html
Результат Nette\Utils\Html

getErrors() публичный Метод

Returns global validation errors.
public getErrors ( ) : array
Результат array

getForm() публичный Метод

Returns self.
public getForm ( $need = TRUE ) : self
Результат self

getGroup() публичный Метод

Returns the specified group.
public getGroup ( $name ) : ControlGroup
Результат ControlGroup

getGroups() публичный Метод

Returns all defined groups.
public getGroups ( ) : ControlGroup[]
Результат ControlGroup[]

getHttpData() публичный Метод

Returns submitted HTTP data.
public getHttpData ( $type = NULL, $htmlName = NULL ) : mixed
Результат mixed

getMethod() публичный Метод

Returns form's method.
public getMethod ( ) : string
Результат string get | post

getOwnErrors() публичный Метод

Returns form's validation errors.
public getOwnErrors ( ) : array
Результат array

getRenderer() публичный Метод

Returns form renderer.
public getRenderer ( ) : Nette\Forms\IFormRenderer
Результат Nette\Forms\IFormRenderer

getToggles() публичный Метод

public getToggles ( ) : array
Результат array

getTranslator() публичный Метод

Returns translate adapter.
public getTranslator ( ) : Nette\Localization\ITranslator | null
Результат Nette\Localization\ITranslator | null

hasErrors() публичный Метод

public hasErrors ( ) : boolean
Результат boolean

isAnchored() публичный Метод

Tells if the form is anchored.
public isAnchored ( ) : boolean
Результат boolean

isMethod() публичный Метод

Checks if the request method is the given one.
public isMethod ( $method ) : boolean
Результат boolean

isSubmitted() публичный Метод

Tells if the form was submitted.
public isSubmitted ( ) : Nette\Forms\ISubmitterControl | FALSE
Результат Nette\Forms\ISubmitterControl | FALSE submittor control

isSuccess() публичный Метод

Tells if the form was submitted and successfully validated.
public isSuccess ( ) : boolean
Результат boolean

receiveHttpData() защищенный Метод

Internal: returns submitted HTTP data or NULL when form was not submitted.
protected receiveHttpData ( ) : array | null
Результат array | null

removeGroup() публичный Метод

Removes fieldset group from form.
public removeGroup ( $name ) : void
Результат void

render() публичный Метод

Renders form.
public render ( $args ) : void
Результат void

setAction() публичный Метод

Sets form's action.
public setAction ( $url ) : self
Результат self

setMethod() публичный Метод

Sets form's method.
public setMethod ( $method ) : self
Результат self

setRenderer() публичный Метод

Sets form renderer.
public setRenderer ( Nette\Forms\IFormRenderer $renderer = NULL ) : self
$renderer Nette\Forms\IFormRenderer
Результат self

setSubmittedBy() публичный Метод

Sets the submittor control.
public setSubmittedBy ( Nette\Forms\ISubmitterControl $by = NULL ) : self
$by Nette\Forms\ISubmitterControl
Результат self

setTranslator() публичный Метод

Sets translate adapter.
public setTranslator ( Nette\Localization\ITranslator $translator = NULL ) : self
$translator Nette\Localization\ITranslator
Результат self

validate() публичный Метод

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

validateMaxPostSize() публичный Метод

public validateMaxPostSize ( )

validateParent() защищенный Метод

protected validateParent ( Nette\ComponentModel\IContainer $parent ) : void
$parent Nette\ComponentModel\IContainer
Результат void

Описание свойств

$httpRequest публичное свойство

used only by standalone form
public $httpRequest

$onError публичное свойство

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

$onRender публичное свойство

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

$onSubmit публичное свойство

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

$onSuccess публичное свойство

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