If using fancybox ajax display the Yii2 cactiveform you will found that the client validation are not working.
Its due to the form ID was invalid or duplicated in same page. what you need to do is assign a new form id inside cactiveform.
Example
$form = ActiveForm::begin([
'enableClientValidation' => true,
'id' => 'new_form_id'
]);
Posted by
chevrons in
Yii2
In Yii2 now you are allow pass an array as param to gridview column for display the data. Below is the example how to pass array to gridview column.
Exmaple:
The
$status is an array and
$data is the model results.
'content' => function($data) use ($status) {
return (isset($status[$data->status]) ? $status[$data->status] : $data->status);
},
Complete Example:
= GridView::widget([
'dataProvider' => $model->search(),
'filterModel' => $model,
'showOnEmpty'=>true,
'columns' => [
'id',
'name',
[
'attribute' => 'status',
'filter' => $status,
'content' => function($data) use ($status) {
return (isset($status[$data->status]) ? $status[$data->status] : $data->status);
},
],
],
]); ?>
Posted by
chevrons in
Yii2