这里我粘贴了选择框的代码
echo $this->Form->input('accounttype', array(
'options' => array('Doctor','Patient') //here 0 means doctor 1 means patient
));
如果在这里我选择了一个选项医生 那么只有第二个选择框应该显示,否则它就赢了
。if($user['accouttype']== 0){
echo $this->Form->input('specality', array(
'options' => array('Anesthesiologist','Emergency medicine','Family medicin','General surgery') //here 0 means doctor 1 means patient
));
答案 0 :(得分:0)
可以使用AJAX完成,并归结为一些jQuery和一些Cake。
看一看 http://www.dereuromark.de/2014/01/09/ajax-and-cakephp/ 这解释了如何以干净的方式利用Cake。
它还在沙箱中有一个实时工作示例代码: chained dropdowns - 代码here。