【发布时间】:2014-01-26 17:23:05
【问题描述】:
我有一个带有选择输入的表单。我想在选择下拉列表时显示警报。 观点:
<?php
echo $this->Form->create('Office');
echo $this->Form->input('under_office', array('type' => 'select', 'options' => $settings,'empty' => false));
echo $this->Form->end('Save');
?>
控制器
public function add() {
$settings = $this->Office->Officetype->find('list', array('fields'=> array('Officetype.id', 'Officetype.name')
));
$this->set(compact('settings'));
if ($this->request->is('post')) {
$this->Office->create();
$post_data = $this->request->data;
if ($this->Office->save($post_data)) {
$this->Session->setFlash(__('Office details saved successfully'));
return $this->redirect(array('action' => 'add'));
}
$this->Session->setFlash(__('Unable to save Office details'));
}
}
【问题讨论】:
标签: javascript jquery cakephp-2.4