Created
January 9, 2012 16:18
-
-
Save tbuyle/1583642 to your computer and use it in GitHub Desktop.
Formtastic Datepicker field.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$("INPUT.datepicker").datepicker(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DatepickerInput < Formtastic::Inputs::StringInput | |
def input_html_options | |
unless object.nil? | |
value = I18n.l(object.send(method)) | |
else | |
value ="" | |
end | |
super.merge(:class => "#{super[:class]} datepicker", :value => value) | |
end | |
end |
how do I use this in a rails application?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Formtastic Custom Input for Jquery UI datepicker.
The input will have the datepicker class an display the date with localised format. (you may have to change $.datepicker default to match your date format)