I am using bootstrap-datepicker.js and it is working fine.
<div class="well">
<div id="dp5" class="input-append date" data-date-format="dd-mm-yyyy" data-date="12-02-2012">
<input class="span2" type="dp5" readonly="" value="12-02-2012" size="16">
<span class="add-on">
<i class="icon-th"></i>
</span>
</div>
</div>
I want to use it in my form in rails which is of such type
<%= simple_form_for(@customer) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :email %>
<%= f.input :address %>
<%= f.input :phone %>
<%= f.input :Projects %>
<%= f.radio_button :status, 0, :checked => true%>Publish
<%= f.radio_button :status, 1 %>Unpublish
<%= f.radio_button :status, 2 %>Trash
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
Here i want to put the date picker inside my form as
`<%f.(datepicker)%>`
so that when i submit my form i get the value of date in the parameter date. When i click on date in datepicker it should hide and the default date should point to the current date. my appication.js includes
$(function(){
$('#dp5').datepicker({
format: 'mm-dd-yyyy'
});
$('#dp3').datepicker({
format: 'mm-dd-yyyy'
});
});
Use
<%= f.text_field :name_of_the_date_column, :value=>Date.today.strftime('%m-%d-%Y'), :id =>"dp5" %>To auto hide use this
instead of