Skip to content Skip to sidebar Skip to footer

Using Datepicker Within Haml

I am sorta new to using datepicker within haml and was hoping to get some guidance. I have included a javascript with a datepicker within my main.html along with two date fields.

Solution 1:

In HAML, the way you indent is key to your code working correctly. You need to change your indentation as follows:

%h3
  Please enter the following information:
= form('/search', :post)
  = input(:id, :report_id, class: "formbox")
  = input(:date, :start_date, class: "formbox")
  = input(:date, :end_date, class: "formbox")
  = submit('Submit', class: "button")

:javascript
  $(function() {
    $( "#start_date, #end_date" ).datepicker({format: 'yyyy-mm-dd'});
  });

Post a Comment for "Using Datepicker Within Haml"