我已经用数据填充了一个下拉框,我可以从列表中选择。我似乎无法将选项设置为所选值。我选择一个值,我希望下拉框显示最后选择的值而不是重置为列表中的第一个选项。我尝试过选中,默认使用和不使用数字。
public function admin_list($tutorId=0,$paycycleId=0) {
if (isset($this->request->data['tutor'])) {
debug($this->request->data['TimeSheet']['tutor']);
$tutorId=$this->request->data['TimeSheet']['tutor'];
return $this->redirect(array('action' => 'admin_list',$tutorId,$paycycleId));
}//isset
view////
echo $this->Form->input('paycycle', array('label' => 'Pay Cycle Period',
'empty' =>array(0 => 'choose'), 'options' => $pcycle,'default'=>2 ));
echo $this->Form->submit('Select a Pay Cycle', array('name'=>'paycycle'));
echo $this->Form->end();