表单代码如下
- $form = ActiveForm::begin([
- 'id' => 'search-form',
- 'method' => 'get',
- ]);
- echo $form->field($Model, 'id');
- echo Html::submitButton('查询', ['class' => 'btn btn-primary']);
- ActiveForm::end();
解决办法很简单,就是为表单添加一个action属性就欧了.修改后的代码如下
- $form = ActiveForm::begin([
- 'id' => 'search-form',
- 'method' => 'get',
- 'action'=>$this->creatUrl('site/search'),
- ]);
- echo $form->field($Model, 'id');
- echo Html::submitButton('查询', ['class' => 'btn btn-primary']);
- ActiveForm::end();
222