本文介绍了Laravel 4与bootstrap-datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Laravel PHP Framework与Bootstrap。我想知道如何在表单中插入日期戳。我已经安装了bootstrap-datepicker,但不知道我将如何使用。
这是我的表单代码:
{{Form :: open数组('action'=>'HomeController @ postRegister'))}}
< p> {{Form :: text('first_name','',array('class'=>'form- control','placeholder'=>'primeiro nome'))}}< / p>
< p> {{Form :: text('last_name','',array('class'=>'form-control','placeholder'=>'últimonome'))}} < / p>
< p> {{Form :: text('email','',array('class'=>'form-control','placeholder'=>'email'))}}< ; / p>
< p> {{Form :: text('phone_number','',array('class'=>'form-control','placeholder'=>'o teunúmerodetelemóvel') )}}< / p>
**< p> {{Form :: text('date_of_birth','',array('class'=>'form-control','placeholder'=>'a tua data de nascimento ''))}}< / p> **
< p> {{Form :: password('password',array('class'=>'form-control','placeholder'=> ;'a tua palavra-passe'))}}< / p>
< p> {{Form :: password('password',array('class'=>'form-control','placeholder'=>'reintroduzir palavra-passe'))}}< ; / p>
< p> {{Form :: submit('regista-te',array('class'=>'btn btn-danger'))}}< / p>
{{Form :: close()}}
我需要替换此代码一个datepicker:
< p> {{Form :: text('date_of_birth','',array('class' ="'form-control','placeholder'=>'a tua data de nascimento'))}}< / p>
像这样:
:
我希望有人可以帮助我:)
谢谢!
解决方案
Twitter bootstrap使用
data-datepicker =datepicker
显示日期选择器。 Laravel将允许您使用与课堂和占位符相同的数组。
< p> {{Form :: text('date_of_birth','',array('class'=>'form-control','placeholder'=>'a tua data de nascimento','data-datepicker'=>'datepicker')) }}< / p>
I'm using Laravel PHP Framework with Bootstrap. I want to know how to insert a datepicker in to a form.
I already have the bootstrap-datepicker installed but do not know how I will use.
Here is the code of my form:
{{ Form::open(array('action' => 'HomeController@postRegister')) }}
<p>{{ Form::text('first_name', '', array('class' => 'form-control','placeholder' => 'primeiro nome')) }}</p>
<p>{{ Form::text('last_name', '', array('class' => 'form-control','placeholder' => 'último nome')) }}</p>
<p>{{ Form::text('email', '', array('class' => 'form-control','placeholder' => 'email')) }}</p>
<p>{{ Form::text('phone_number', '', array('class' => 'form-control','placeholder' => 'o teu número de telemóvel')) }}</p>
**<p>{{ Form::text('date_of_birth', '', array('class' => 'form-control','placeholder' => 'a tua data de nascimento')) }}</p>**
<p>{{ Form::password('password', array('class' => 'form-control','placeholder' => 'a tua palavra-passe')) }}</p>
<p>{{ Form::password('password', array('class' => 'form-control','placeholder' => 'reintroduzir palavra-passe')) }}</p>
<p>{{ Form::submit('regista-te', array('class' => 'btn btn-danger')) }}</p>
{{ Form::close() }}
I need to replace this code for a datepicker:
<p>{{ Form::text('date_of_birth', '', array('class' => 'form-control','placeholder' => 'a tua data de nascimento')) }}</p>
Like this:
As a componet:
I hope someone can help me :)
Thanks!
解决方案
Twitter bootstrap uses
data-datepicker="datepicker"
to show the date picker. Laravel will allow you to use this is the same array as the class and placeholder.
<p>{{ Form::text('date_of_birth', '', array('class' => 'form-control','placeholder' => 'a tua data de nascimento','data-datepicker' => 'datepicker')) }}</p>
这篇关于Laravel 4与bootstrap-datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!