表單程式碼如下
$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