echo $this->Form->create('Driver', array('type' => 'get'));
echo $this->Form->input('name');
echo $this->Form->end('Search');
结果 $this->request:
query => array(
'name' => 'some name'
)
问题是搜索后输入表单为空,尽管$this->request->query['name'] = 'some name'
在将表单更改回时一切都按预期工作post
编辑。包括模型和控制器。对于测试,我使用全新安装。型号(Driver.php):
App::uses('AppModel', 'Model');
class Driver extends AppModel {
public $displayField = 'name';
}
控制器(DriversController.php):
App::uses('AppController', 'Controller');
class DriversController extends AppController {
public function index() {
$drivers = $this->Driver->find('all');
$this->set(compact('drivers'));
}
}