【发布时间】:2011-09-06 18:57:24
【问题描述】:
我在使用表单选择助手时遇到问题。在我的页面上,我有两个表单。
一个是快速搜索表单。这个使用 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'),
);
}
?>
在网址中: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));
?>
【问题讨论】:
标签: php cakephp form-helpers