I’m trying to install the jQuery UI datepicker with Formtastic. I followed http://blog.brzezinka.eu/webmaster-tips/ruby/ruby-on-rails-formtastic-jquery-ui-datepicker so I:
- added jQuery UI (confimed it works with other elements)
- installed Formtastic 2.0.2 (confimed it works with other elements)
- Adjusted application.js
- Adjusted Formtastic.rb as described in the tutorial and the comments
- Changed view
I keep getting ‘Formtastic::UnknownInputError’ on <%= f.input :dtstart, :as => :datepicker %>. I googled and searched for this error but can’t find a clue in which direction to look. Anybody here an idea? I’m on rails 3.0.3
if you’re using
:as => :datepicker, you have to create a custom input for it.As the documentation suggests, create a new file in
app/inputsnameddate_picker_input.rbAll you have to do is trigger the JQuery UI addon in your
application.js:If you don’t want to bother creating a custom input, you can just add the class directly as in: