我在使用表单选择助手时遇到问题。在我的页面上,我有两种形式。
一种是快速搜索表格。这个使用 state_id。在 URL 中搜索时:state_id:CO 这将在下拉列表中自动选择正确的值。
但是,当我使用高级表单进行搜索时。该字段是 trail_state_id 并且在 URL 中: trail_state_id:CO 出于某种原因,它不会默认为正确的值。它只是将表单重置为无选择。这些值被正确搜索,只是表单助手没有识别出在 url 中设置了同名的字段。有什么想法吗?
<?php
class Trail extends AppModel {
public $filterArgs = array(
array('name' => 'state_id','field'=>'Area.state_id', 'type' => 'value'),
array('name'=>'trail_state_id','field'=>'Area.state_id','type'=> 'value'),
);
}
?>
在 URL 中:trail_state_id:CO
<?php
echo '<h4>State*:</h4><div>'.$this->Form->select('trail_state_id', $stateSelectList, null, array('style'=>'width:200px;','escape' => false,'class'=> 'enhanced required','empty'=> false));
?>