ActiveForm
,我正在尝试添加一个
GridView
通过搜索选择要添加到关系中的项目(数据库为MongoDB)
我想包括“搜索和选择”
GridView
控件,并将项目添加到
活性形式
作为ID数组建模。
例如:
<?php $form = ActiveForm::begin();?>
<?=$form->field($model, 'summary')->textInput()?>
<?=
GridView::widget([
'id' => 'productSearch',
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'pjax' => true,
'columns' => [
'name',
],
])
?>
<!-- Display the Assigned Products selected by productSearch -->
<?=
GridView::widget([
'id' => 'assignedProducts',
'dataProvider' => $model->AssignedProducts,
'columns' => ([
'name',
]),
]);?>
<?php ActiveForm::end();?>
但是当我把
GridView
在
ActiveForm::begin()
/
ActiveForm::end()
标签,被调用的“POST”触发表单。
有关于这种设置的指南吗?
还是我需要从头开始创建整个表单?
我知道我很可能需要使用一点jQuery来从
GridView
当它们被正确选择时?