【问题标题】:Cakephp 3.0 form dropdown how to show levelCakephp 3.0 表单下拉菜单如何显示级别
【发布时间】:2015-03-26 09:21:59
【问题描述】:

我正在尝试为性别添加一个表单字段,下面是我的代码:

$options = ['m' => '男', 'f' => '女']; echo $this->Form->select('gender', $options);

但在我的视图文件中,我看不到 lebel 性别是否有任何其他代码可以帮助我提出建议。

【问题讨论】:

    标签: forms cakephp-3.0


    【解决方案1】:

    From->select 没有给出正确的标签。做吧:

    echo $this->Form->input('gender', array(
        'options' => $options,
        'type' => 'select',
        'empty' => 'Select the gender',
        'label' => 'Gender'
       )
    );
    

    【讨论】:

    • 密码的所有 lebel 和其他的都是深色,但在你的代码中它更亮有什么办法可以解决这个问题
    • 你能链接网站还是在本地?如果你想改变颜色,你应该改变 CSS
    【解决方案2】:
     <?= $this->Form->select('gender', ['m' => 'Male', 'f' => 'Female'], ['class' => 'form-control', 'required' => true])?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-19
      • 1970-01-01
      • 2017-06-01
      • 2012-05-27
      • 1970-01-01
      • 2013-08-12
      相关资源
      最近更新 更多