Laravel Collective HTML5属性

时间:2016-10-27 01:50:10

标签: php laravel laravelcollective

如何传递HTML5属性,例如:必需,自动对焦......?

我可以输入名称为" value"的其他属性,但不能输入仅包含一个单词的属性。

2 个答案:

答案 0 :(得分:3)

将值作为第三个(select作为第四个)参数传递给数组:

{!! Form:: text('name', null, ['required' => true, 'some-param' => 'itsValue', 'class' => 'some-class' ]) !!}

答案 1 :(得分:2)

以下是一些例子:

{!! Form::label('title', 'Title') !!}

{!! Form::text('title', null, ['class' => 'form-control', 'placeholder' => 'Interview']) !!}

{!! Form::textarea('description', null, [ 'size' => '1x3', 'class' => 'form-control', 'placeholder' => 'Something']) !!}

{!! Form::select('timeOption', [null => 'Please Select', '1' => 'N/A', '2' => 'Instructor', '3' => 'Student'], null, ['required' => true]) !!}

{!! Form::date('task_date', Carbon\Carbon::now(), ['class' => 'form-control']) !!}

{!! Form::time('task_time', Carbon\Carbon::now()->format('H:i'),  ['class' => 'form-control']) !!}

{!! Form::number('lat', null, ['class' => 'form-control', 'step' => 'any', 'placeholder' => '41.3770401']) !!}

{!! Form::submit('Add', ['class' => 'btn btn-success']) !!}