2012-05-14 3 views
0

데이터하는 오류 (관련 테이블)을 절약 cakephp211이 내 형태 :나는 두 개의 관련 테이블 (고객 hasMany의 명령)가

<?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

당신은 $ this-> 요청 -> 데이터가 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);  
    } 
} 
관련 문제