I have a wizard form in my yii2 project. My form is type of yii2 active form.
Now I want to validate each part separately. for example first section of wizard includes t1
, t2
, t3
and second section includes t4
, t5
. when user click the next step button of section 1 I want just verify t1
, t2
and t3
but not t4
and t5
. How should I do this in yii2?
Edit
Please notice that I want use yii2 validator and don't want to write validation rules in my jquery code again.
Edit: Please check the code
$wizard_config = [
'id' => 'stepwizard',
'steps' => [
1 => [
'title' => 'اطلاعات پروژه',
'icon' => 'fa fa-info',
'content' =>
$form->field($model, 'title') .
$form->field($model, 'language_id')->dropDownList($language, ['style' => 'padding-top: 0;', 'prompt' => 'زبان']) .
$form->field($model, 'project_type_id')->dropDownList($project_type, ['style' => 'padding-top: 0;']) .
$form->field($model, 'text_type_id')->dropDownList($text_type, ['style' => 'padding-top: 0;']) .
$form->field($model, 'description')->textarea(['style'=>'height: 140px;resize:none;'])
,
],
2 => [
'title' => 'فایل های پروژه',
'icon' => 'fa fa-upload',
'content' =>
$form->field($model, 'proj_file')->fileInput() .
$form->field($model, 'pages') .
$form->field($model, 'template')->fileInput()
,
],
3 => [
'title' => 'زمان و قیمت',
'icon' => 'fa fa-clock-o',
'content' =>
$form->field($model, 'deadline_day') .
$form->field($model, 'deadline_time') .
$form->field($model, 'doing_way_id') .
$form->field($model, 'user_id') .
$form->field($model, 'pawn_money') .
$form->field($model, 'is_group')
,
],
4 => [
'title' => 'تایید',
'icon' => 'fa fa-check',
'content' => '<h3>Step 3</h3>This is step 3',
],
],
'start_step' => 1,
];
yii2-formwizard
– Muhammad Omer Aslam