3

How do I pass in an HTML5 attributes like: required, auto focus...?

I can enter other attributes which have name="value", but not an attribute that consist of only one word.

4

2 回答 2

4

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

{!! Form:: text('name', null, ['required' => true, 'some-param' => 'itsValue', 'class' => 'some-class' ]) !!}
于 2016-10-27T02:26:19.560 回答
3

这里有些例子:

{!! 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']) !!}
于 2017-09-15T05:57:24.367 回答