Rails 3更改数据时切换菜单重新加载页面
用户可以编辑他的帐户,并有一个菜单来选择他的社区:
<%= form_for @user, :html => { :multipart => true } do |f| %>
<%= f.collection_select :community_id, Community.find(:all,
:include => :memberships,
:conditions => ['memberships.user_id = ? and memberships.role > ?', @user.id, '0' ]),
:id,
:name,
:style => "width: 200px;" %>
<% end %>
我想将此菜单放在显示页面上,并让他可以直接切换。
在rails 2中,我使用了observe_field或:onchange => 'this.form.onsubmit()' 我不知道java…
The user can edit his account and has a menu to choose his community :
<%= form_for @user, :html => { :multipart => true } do |f| %>
<%= f.collection_select :community_id, Community.find(:all,
:include => :memberships,
:conditions => ['memberships.user_id = ? and memberships.role > ?', @user.id, '0' ]),
:id,
:name,
:style => "width: 200px;" %>
<% end %>
I would like to put this menu on the show page and give him the possibility to switch directly.
With rails 2, I used observe_field or :onchange => 'this.form.onsubmit()' and I don't know java…
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 'this.form.onsubmit() 更改为 'this.form.submit()
Changed 'this.form.onsubmit() to 'this.form.submit()