-
Notifications
You must be signed in to change notification settings - Fork 14
Enable Ajax Validation
Coackroach edited this page Jan 19, 2020
·
2 revisions
Enable the Ajax validation by using the 'enableAjaxValidation'=>true,
for the formOptions
use buttflatteryormwizard\FormWizard;
echo FormWizard::widget([
'formOptions'=>[
'id'=>'my_form_ajax',
'enableClientValidation'=>false,
'enableAjaxValidation'=>true,
],
'steps' => [
[
'model' => $shootsModel,
'title' => 'My Shoots',
'description' => 'Add your shoots',
'formInfoText' => 'Fill all fields'
],
[
'model' => $shootTagModel,
'title' => 'Shoot Tags',
'description' => 'Add your shoot tags',
'formInfoText' => 'Fill all fields'
],
]
]);
//controller code
public function actionIndex()
{
$shootModel = new \app\models\Shoots();
$shootTagModel = new \app\models\ShootTag();
//for ajax validation
if (Yii::$app->request->isAjax && Yii::$app->request->isPost) {
Yii::$app->response->format = Response::FORMAT_JSON;
$shootModel->load(Yii::$app->request->post());
$shootTagModel->load(Yii::$app->request->post());
return array_merge(ActiveForm::validate($shootModel),ActiveForm::validate($shootTagModel) );
}
return $this->render('index', ['shootsModel' => $shootModel, 'shootTagModel' => $shootTagModel]);
}
- Get Running with Minimal Options
- Disable ActiveForm Validation
- Enable Ajax Validation
- Add Custom Buttons
- Widget Constants
- Customizing Form Fields
- Configuring File Uploads
- Custom Field Order
- Single Model Across Steps
- Multiple models in a single step
-
Tabular Steps-(New)
- Working With Widgets
- Limiting Rows
- Dependent Inputs Since v1.7.2
- Skip-able Step-(Since v1.5.0)
- Enable Preview Step-(New)
- Group Fields-(New)
- Enable Form Persistence-(New)
- Enable Edit Mode - (Since v1.6.4)