0

我无法获取自动检查的值。选项列表显示正常。

$this->data['Business']['ExpertiseType'] 有值。

在所有三个模型中定义的业务 habtm ExpertiseType 仍设置为其默认烘焙。

业务属于形式EoiEntry

$this->data = $this->FormEoiEntry->find('first', ['conditions'=>['FormEoiEntry.id'=>1324], 'recursive'=>2]);


$this->Form->create('FormEoiEntry');
$this->Form->input('Business.ExpertiseType', ['multiple'=>'checkbox']);
$this->Form->end();

我在这里错过了什么吗?我无法弄清楚为什么它没有被检测到并选中这些框。

4

1 回答 1

0

expertise_types像这样从您的控制器设置。

$this->set('expertise_types', $this->FormEoiEntry->find('first', [
    'conditions'=>['FormEoiEntry.id'=>1324], 
    'recursive'=>2,
]);

在你看来

$this->Form->input('Business.ExpertiseType', [
    'options' => $expertise_types,
    'multiple'=>'checkbox'
]);

更新

在这种情况下,将选定的选项值传递给$this->request->data['Business']['ExpertiseType']

像这样

$this->request->data['Business']['ExpertiseType'] = array(
    'select option value 1', // you can put your option values
    'select option value 2',
    'select option value 3',
    'select option value 4',
);
于 2013-12-03T15:02:07.043 回答