Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simple_forms custom data attribute

I would like to have an additional data attribute on an input tag generated by simple_form. The following does not work:

<%= f.input :date, :as => 'date_picker', :data => {:datepicker => :datepicker}  %> 

How could this be done? Is it possible at all? As you might have guessed: I am trying to add bootstrap-datepicker to my site without using explicit js to initialize the date picker.

like image 332
Ynv Avatar asked Nov 30 '11 13:11

Ynv


1 Answers

The correct API is:

f.input :date, :as => 'date_picker', :input_html => { :data => {:datepicker => :datepicker} } 
like image 97
rafaelfranca Avatar answered Sep 18 '22 12:09

rafaelfranca