Datepicker ui 与 formattastic,rails 3.1
我使用rails 3.1,formtastic 2.0.2和datepicker ui
我制作了datepicker_input.rb:
class DatepickerInput < Formtastic::Inputs::StringInput
include Formtastic::Inputs::Base
def input_html_options
super.merge(:class => "datepicker")
end
end
在application.js中我写道:
$('input.datepicker').datepicker()
我在我的表单中使用它,例如:as =>; :日期选择器。我看到日历,选择日期,一切都很好,除了它没有填充我的模型中的列。我注意到的唯一一件事是,当我填写第一个日期,然后填写所有其他字段时 - 它起作用了。当日期字段是最后一个时 - 它不起作用。没有错误,params[:model_name][:date_field] 不为空,只是用 nil 代替我选择的日期。
I use rails 3.1, formtastic 2.0.2 and datepicker ui
I made datepicker_input.rb:
class DatepickerInput < Formtastic::Inputs::StringInput
include Formtastic::Inputs::Base
def input_html_options
super.merge(:class => "datepicker")
end
end
In application.js I wrote:
$('input.datepicker').datepicker()
I use it in my form like :as => :datepicker. I see calendar, pick date and everything is fine except for it doesn't fill column in my model. The only thing that I noticed is that when I fill first date and then all the other fields - it works. When date field is the last - it doesn't work. There is no errors, params[:model_name][:date_field] is not empty just nil in place of date that I chose.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
日期格式错误 - 数据库无法采用返回日期选择器的格式。
Error was in date format - database just couldn't take format that returned datepicker.