Methods summary
public
array
|
#
Submit( array & $rawRequestParams = [] )
Process standard low level submit process.
If no params passed as first argument, all params from object
\MvcCore\Application::GetInstance()->GetRequest() are used.
- If fields are not initialized - initialize them by calling $form->Init(); .
- Check maximum post size by php configuration if form is posted.
- Check cross site request forgery tokens with session tokens.
- Process all field values and their validators and call $form->AddError() where necessary.
AddError() method automatically switch $form->Result property to zero - 0 , it means error submit result.
Return array with form result, safe values from validators and errors array.
Process standard low level submit process.
If no params passed as first argument, all params from object
\MvcCore\Application::GetInstance()->GetRequest() are used.
- If fields are not initialized - initialize them by calling $form->Init(); .
- Check maximum post size by php configuration if form is posted.
- Check cross site request forgery tokens with session tokens.
- Process all field values and their validators and call $form->AddError() where necessary. AddError() method automatically switch $form->Result property to zero - 0 , it means error submit result.
Return array with form result, safe values from validators and errors array.
Parameters
- $rawRequestParams
- optional
Returns
array An array to list: [$form->result, $form->data, $form->errors];
|
public
MvcCore\Ext\Form
|
#
SubmitSetStartResultState( array & $rawRequestParams = [] )
Try to set up form submit result state into any special positive
value by presented submit button name in $rawRequestParams array
if there is any special submit result value configured by button names
in $form->customResultStates array. If no special button submit result
value configured, submit result state is set to 1 by default.
Try to set up form submit result state into any special positive
value by presented submit button name in $rawRequestParams array
if there is any special submit result value configured by button names
in $form->customResultStates array. If no special button submit result
value configured, submit result state is set to 1 by default.
Parameters
Returns
|
public
boolean
|
#
SubmitValidateMaxPostSizeIfNecessary( )
Validate maximum posted size in POST request body by Content-Length HTTP header.
If there is no Content-Length request header, add error.
If Content-Length value is bigger than post_max_size from PHP INI, add form error.
Validate maximum posted size in POST request body by Content-Length HTTP header.
If there is no Content-Length request header, add error.
If Content-Length value is bigger than post_max_size from PHP INI, add form error.
Returns
boolean
|
public
MvcCore\Ext\Form
|
#
SubmitAllFields( array & $rawRequestParams = [] )
Go through all fields, which are not button:submit or input:submit types
and call on every $field->Submit() method to process all configured field validators.
If method $field->Submit() returns anything else than NULL , that value is automatically
assigned under field name into form result values and into form field value.
Go through all fields, which are not button:submit or input:submit types
and call on every $field->Submit() method to process all configured field validators.
If method $field->Submit() returns anything else than NULL , that value is automatically
assigned under field name into form result values and into form field value.
Parameters
Returns
|
public
|
#
SubmittedRedirect( )
Call this function in custom \MvcCore\Ext\Form::Submit(); method implementation
at the end of custom Submit() method to redirect user by configured success/error/prev/next
step URL address into final place and store everything into session.
You can also to redirect form after submit by yourself.
Call this function in custom \MvcCore\Ext\Form::Submit(); method implementation
at the end of custom Submit() method to redirect user by configured success/error/prev/next
step URL address into final place and store everything into session.
You can also to redirect form after submit by yourself.
|
public
MvcCore\Ext\Forms\Validator
&
|
#
GetValidator( string $validatorName )
Get cached validator instance by name. If validator instance doesn't exist
in $this->validators array, create new validator instance, cache it and return it.
Get cached validator instance by name. If validator instance doesn't exist
in $this->validators array, create new validator instance, cache it and return it.
Parameters
Returns
|
public
string
|
#
GetDefaultErrorMsg( integer $index )
Get error message string from internal protected static property
\MvcCore\Ext\Form::$defaultErrorMessages by given integer index.
Get error message string from internal protected static property
\MvcCore\Ext\Form::$defaultErrorMessages by given integer index.
Parameters
Returns
string
|
protected
array
&
|
#
submitAllFieldsEncodeAcceptCharsets( array & $rawRequestParams = [] )
If form has defined any accept-charset attribute values,
go through all accept charset(s) and try to transcode all raw values
and collect translation statistics from this process. Then decode
best translation charset and return by given param $rawRequestParams
new translated raw values by first best charset in accept-charset attribute.
If form has defined any accept-charset attribute values,
go through all accept charset(s) and try to transcode all raw values
and collect translation statistics from this process. Then decode
best translation charset and return by given param $rawRequestParams
new translated raw values by first best charset in accept-charset attribute.
Parameters
- $rawRequestParams
- $rawRequestParams
Returns
array
|
protected
array
|
#
encodeAcceptCharsetsArrayOrString( string|string[] & $rawValue, string $fromEncoding, string $toEncoding )
Try to encode raw input array or string by iconv()
from given $fromEncoding charset to given $toEncoding
charset. Return array with records:
- 0 - Wow many items has been transcoded without error.
- 1 - How many items has been transcoded.
- 2 - Transcoded raw input string by iconv() .
Try to encode raw input array or string by iconv()
from given $fromEncoding charset to given $toEncoding
charset. Return array with records:
- 0 - Wow many items has been transcoded without error.
- 1 - How many items has been transcoded.
- 2 - Transcoded raw input string by iconv() .
Parameters
- $rawValue
- $fromEncoding
- $toEncoding
Returns
array
|
protected
array
|
#
encodeAcceptCharsetsString( string|string[] & $rawValue, string $fromEncoding, string $toEncoding )
Try to encode raw input string by iconv()
from given $fromEncoding charset to given $toEncoding
charset. Return array with records:
- 0 - Wow many items has been transcoded without error.
- 1 - How many items has been transcoded.
- 2 - Transcoded raw input string by iconv() .
Try to encode raw input string by iconv()
from given $fromEncoding charset to given $toEncoding
charset. Return array with records:
- 0 - Wow many items has been transcoded without error.
- 1 - How many items has been transcoded.
- 2 - Transcoded raw input string by iconv() .
Parameters
- $rawValue
- $fromEncoding
- $toEncoding
Returns
array
|