【发布时间】:2015-07-06 09:24:59
【问题描述】:
我正在使用this 之后的引导水平表单创建一个基本表单
一切正常,但是当我尝试使用密码类型并生成下拉列表时,它不起作用。根据 cakephp 文档,我需要覆盖 InputDefaults,但还没有运气。到目前为止我的代码
<?php echo $this->Form->create('User',
array('action' => 'registration', 'class'=>'form-horizontal',
'inputDefaults'=>array(
'format' => array('before', 'label', 'between', 'input', 'error', 'after'),
'div' => array('class' => 'form-group'),
'label' => array('class' => 'control-label col-sm-4'),
'between' => '<div class="col-sm-6">',
'after' => '</div>',
'class'=>'form-control',
'error' => array('attributes' => array('wrap' => 'span', 'class' => 'help-inline'))
)
));
echo $this->Form->input('user_pass',
array(
'label'=>array('text'=>'Password','class'=>'control-label col-sm-4')
)
);
echo $this->Form->input('question', array(
'label'=>array('text'=>'Security Question','class'=>'control-label col-sm-4')
)
?>
我知道如果我更改 $this->Form->input('password'),它将适用于密码类型。但我想使用 user_paas 并且我知道如何使用生成下拉菜单
echo $this->Form->input('question', array(
'type' => 'select',
'options' => $question,
'class' =>'form-control',
)
);
【问题讨论】: