【问题标题】:Laravel Custom Form TypeLaravel 自定义表单类型
【发布时间】:2014-01-23 17:56:03
【问题描述】:

在 Laravel 中,我们可以用这个来做表单:

{{Form::radio(name, value, checked, options)}}
{{Form::checkbox(name, value, checked, options)}}
{{Form::select(name, list, selected, options)}}
{{Form::text(name, value, options)}}
{{Form::textarea(name, value, options)}}

但是,对于自定义类型的输入,我们该如何做呢?例如:

<input type='color' name='color' class='colorpicker' />

这个我试过了,还是不行:

{{Form::text('color', null, array("type"=>"color"))}}

如何使用 Laravel 表单实现这一点?

谢谢。

【问题讨论】:

    标签: php laravel laravel-4


    【解决方案1】:

    要生成color 类型的输入,您需要使用input 方法:

    {{ Form::input('color', 'car_color', null, array('class' => 'input-big')) }}
    

    这是input方法的声明:

    public function input($type, $name, $value = null, $options = array()) { ... }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-29
      • 1970-01-01
      • 2022-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多