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.

Pang
  • 9,564
  • 146
  • 81
  • 122
Guntar
  • 473
  • 8
  • 23

2 Answers2

4

Pass the array with values as third (for select as fourth) parameter:

{!! Form:: text('name', null, ['required' => true, 'some-param' => 'itsValue', 'class' => 'some-class' ]) !!}
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
3

Here are some examples:

{!! 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']) !!}
Ramin
  • 335
  • 4
  • 14