I have a CActiveForm
with this summary:
.
.
.
'id'='email-form',
'enableAjaxValidation`=>true,
'clientOptions' => array('validateOnSubmit'=>true),
.
.
.
Now i intend collect form Errors in Server-Side and sent it via json object
to the client. in Client-Side there
is and Jquery function that parse the json object(form Errors)
and set data to errorSummary and at last
shows the errorSummary of form.
i have done it without any problem, my question is what following functions don't collect form Errors:
protected function getErrorSummary($model)
{
if(isset($_POST['ajax']) && $_POST['ajax']==='email-form'){
$errors=CActiveForm::validate($model);
if($errors !== '[]')
Yii::app()->end($errors);
}
}
But following collect form Errors:
protected function getErrorSummary($model)
{
$errors=CActiveForm::validate($model);
if($errors !== '[]')
Yii::app()->end($errors);
}
notice that both functions truly acts on validateOnChange
.