$('#contact-form').yiiActiveForm('add', {
id: 'address',
name: 'address',
container: '.field-address',
input: '#address',
error: '.help-block',
validate: function (attribute, value, messages, deferred, $form) {
yii.validation.required(value, messages, {message: "Validation Message Here"});
}
});
public function actionAppointmentValidate(){
$model = new FrontendAppointmentForm();
if ($model->load(\Yii::$app->request->post())) {
$model->validate();
$errors = [];
foreach ($model->errors as $error => $value){
$errors[] = [
'attribute' => $error,
'value' => $value
];
}
return $errors;
}
return [];
}