philly2013 philly2013 - 1 year ago 106
PHP Question

How do I add HTML 5 type attribute to laravel blade?

I have this line in blade format

{{ Form::text('date', null, array('class' => 'form-control', 'type' => 'Date', 'placeholder' => 'Date' )) }}

but when the page loads the type attribute does not get resolved to 'date', it goes to 'text'.

How do I get this in blade?

<input class="form-control" type="date" placeholder="Date" name="date">

Answer Source

Use Form::input()

Form::input('date', 'date', null, ['class' => 'form-control', 'placeholder' => 'Date']);

Additionally, you can create a Form Macro to "add" methods for HTML5 attributes, such as date, email, time, etc.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download