轨道 3 和Ajax date_select onchange =>;提交
我希望每次通过 ajax 更改日期时都能保存我的日期,这可能吗?我尝试了
<%= form_for @dates,:remote => true do |f| %>
<%= f.date_select :booking_date,:onchange => "this.form.submit();" %>
<% end %>
,但没有任何作用,有什么好的解决方法吗?
I'd like my date to get saved anytime I change my date via ajax, is this possible? I tried
<%= form_for @dates,:remote => true do |f| %>
<%= f.date_select :booking_date,:onchange => "this.form.submit();" %>
<% end %>
but it does nothing, any good work arounds?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自rails文档:
因为onchange是一个html选项,所以您需要为date_select提供一组空选项,否则它假设onchange是一个date_select选项。
您应该将对 date_select 的调用更改为如下所示:
From the rails documentation:
Because onchange is an html option you need to provide an empty set of options to date_select, otherwise it assumes onchange is a date_select option.
You should change your call to date_select to look like this:
您是否将其包含在您的布局中:
Are you including this in your layout: