2012-05-14 18 views
0

我有兩個關聯的表(客戶的hasMany命令),這是我的表單:cakephp211保存數據誤差修改相關(表)

<?php echo $this->Form->create('Customer');?> 
echo $this->Form->input('Client.name', array('disabled' => true,'value' => 'francis')); 
echo $this->Form->input('Command.0.the_date'); 
echo $this->Form->end(__('save'));?> 

,這是我的函數:

public function add() { 
    if (!empty($this->request->data)) { 
     unset($this->Customer->Command->validate['customers_id']); 
     $this->Customer->saveAssociated($this->request->data);  
    } 
} 

但是,當我過程保存數據,沒有任何反應! 爲什麼? 謝謝!

+0

你可以張貼$這個 - >請求 - >數據看起來像在POST後的控制器是什麼? –

+0

謝謝男人!我發現!輸入必須激活:'disabled'=> false – John

回答

0

請使用此行控制器上

var $uses = array('Customer','Command'); 

public function add() { 
    if (!empty($this->request->data)) { 
     unset($this->Customer->Command->validate['customers_id']); 
     $this->Customer->saveall($this->request->data);  
    } 
}