Form
class Form extends Container implements IHtmlString
Creates, validates and renders HTML forms.
Constants
EQUAL |
validator |
IS_IN |
validator |
NOT_EQUAL |
validator |
IS_NOT_IN |
validator |
FILLED |
validator |
BLANK |
validator |
REQUIRED |
validator |
VALID |
validator |
deprecated PROTECTION |
|
SUBMITTED |
|
MIN_LENGTH |
|
MAX_LENGTH |
|
LENGTH |
|
|
|
URL |
|
PATTERN |
|
INTEGER |
|
NUMERIC |
|
FLOAT |
|
MIN |
|
MAX |
|
RANGE |
|
COUNT |
|
MAX_FILE_SIZE |
|
MIME_TYPE |
|
IMAGE |
|
MAX_POST_SIZE |
|
GET |
method |
POST |
method |
DATA_TEXT |
submitted data types |
DATA_LINE |
|
DATA_FILE |
|
DATA_KEYS |
|
internal TRACKER_ID |
|
internal PROTECTOR_ID |
|
Properties
callable[] | $onSuccess | ||
callable[] | $onError | ||
callable[] | $onSubmit | ||
IRequest | $httpRequest | ||
array read-only | $errors | ||
Html read-only | $elementPrototype |
Methods
Form constructor.
No description
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
Returns form's action.
Returns form's method.
Cross-Site Request Forgery (CSRF) form protection.
Adds fieldset group to the form.
Removes fieldset group from form.
Returns all defined groups.
Returns the specified group.
Sets translate adapter.
Returns translate adapter.
Tells if the form is anchored.
Tells if the form was submitted.
Tells if the form was submitted and successfully validated.
Returns submitted HTTP data.
Fires submit/click events.
Internal: returns submitted HTTP data or NULL when form was not submitted.
Performs the server side validation.
No description
Adds global error message.
Returns global validation errors.
No description
No description
Returns form's validation errors.
Returns form's HTML element template.
Returns form renderer.
Renders form.
Renders form to string.
No description
Details
at line 114
__construct($name = NULL)
Form constructor.
at line 130
protected void
validateParent(IContainer $parent)
No description
at line 143
protected void
attached($obj)
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
at line 155
Form
getForm($need = TRUE)
Returns self.
at line 166
Form
setAction($url)
Sets form's action.
at line 177
mixed
getAction()
Returns form's action.
at line 188
Form
setMethod($method)
Sets form's method.
at line 202
string
getMethod()
Returns form's method.
at line 213
CsrfProtection
addProtection($message = NULL)
Cross-Site Request Forgery (CSRF) form protection.
at line 225
ControlGroup
addGroup($caption = NULL, $setAsCurrent = TRUE)
Adds fieldset group to the form.
at line 248
void
removeGroup($name)
Removes fieldset group from form.
at line 273
ControlGroup[]
getGroups()
Returns all defined groups.
at line 284
ControlGroup
getGroup($name)
Returns the specified group.
at line 297
Form
setTranslator(ITranslator $translator = NULL)
Sets translate adapter.
at line 308
ITranslator|null
getTranslator()
Returns translate adapter.
at line 321
bool
isAnchored()
Tells if the form is anchored.
at line 331
ISubmitterControl|false
isSubmitted()
Tells if the form was submitted.
at line 344
bool
isSuccess()
Tells if the form was submitted and successfully validated.
at line 355
Form
setSubmittedBy(ISubmitterControl $by = NULL)
internal |
Sets the submittor control.
at line 366
mixed
getHttpData($type = NULL, $htmlName = NULL)
Returns submitted HTTP data.
at line 387
void
fireEvents()
Fires submit/click events.
at line 430
protected array|null
receiveHttpData()
Internal: returns submitted HTTP data or NULL when form was not submitted.
at line 459
void
validate(array $controls = NULL)
Performs the server side validation.
at line 471
validateMaxPostSize()
internal |
No description
at line 492
void
addError($message)
Adds global error message.
at line 502
array
getErrors()
Returns global validation errors.
at line 511
bool
hasErrors()
No description
at line 520
void
cleanErrors()
No description
at line 530
array
getOwnErrors()
Returns form's validation errors.
at line 543
Html
getElementPrototype()
Returns form's HTML element template.
at line 558
Form
setRenderer(IFormRenderer $renderer = NULL)
Sets form renderer.
at line 569
IFormRenderer
getRenderer()
Returns form renderer.
at line 582
void
render()
Renders form.
at line 595
string
__toString()
Renders form to string.
at line 631
array
getToggles()
No description