سؤال

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">
هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

I'm not sure but have you try changing Form::text to Form::date?

With Laravel 5.1, I am using this for date field.

{!! Form::date('start_date', null, ['class' => 'form-control col-md-7 col-xs-12', 'placeholder' => 'Date']); !!}

There are also a couple composer/packagist packages you can quickly install to use HTML5 elements the same way as text, email, and url (eg: Form::date('myDateField'))

Here's one: https://github.com/smalldogs/html5inputs

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top