編集画面でバリデーションチェックを行いたいのですがバリデーションチェックを行うと
編集画面(ビュー)でエラーメッセージはでますがページ繊維をさせるためのIDをとっておれません。
【view:admin_edit.ctp】---------------------------------------------------
<?php echo $this->Form->create('Notice', array('type' => 'file', 'url' => 'admin_edit/'.$data['Notice']['id'])); ?> <table> <tr> <th> タイトル</th> <td> <?php echo $this->Form->input('Notice.title', array('label' => false, 'div' => false, 'default' => $data['Notice']['title'])); ?> </td> </tr> </table> <?php echo $this->Form->end('submit'); ;?>
【controller: NoticesController】---------------------------------------------------
$NoticeData= $this->request->data;
if ($this->Notice->save($NoticeData)) {
return $this->redirect(
array('controller' => 'Notices', 'action' => 'admin_index')
);
} else {
return $this->redirect('admin_edit');
}
【model:Notice.php】---------------------------------------------------
public $validate = array(
'title' => array(
'between' => array(
'rule' => array('between', 1, 50),
'message' => 'タイトルは50文字以内'
)
),
'notice_text' => array(
'between' => array(
'rule' => array('between', 1, 1000),
'message' => '本文は1000文字以内'
)
),
);