我正在使用带有Bootstrap的Laravel PHP框架.我想知道如何在表单中插入日期选择器.
我已经安装了bootstrap-datepicker,但不知道如何使用.
这是我表格的代码:
{{ 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() }}
我需要用以下代码替换日期选择器:
<p>{{ Form::text('date_of_birth', '', array('class' => 'form-control','placeholder' => 'a tua data de nascimento')) }}</p>
像这样:
作为竞争对手:
我希望有一个人可以帮助我 :)
谢谢!
解决方法:
Twitter引导程序使用
data-datepicker="datepicker"
显示日期选择器. Laravel将允许您使用与类和占位符相同的数组.
<p>{{ Form::text('date_of_birth', '', array('class' => 'form-control','placeholder' => 'a tua data de nascimento','data-datepicker' => 'datepicker')) }}</p>