是否可以在observe_field帮助器中放置一个条件?
使用观察字段助手,我正在保存数据并使旋转器在更新时可见。另外,我想更新一个div。可以用observe_field helper 中的条件来完成吗?
<%= observe_field 'act_feb',
:url => { :controller => :prep, :action => :toggle_feb },
:method => :put,
:loading => "$('feb_spinner').setStyle({visibility: 'visible'});",
:complete => "$('feb_spinner').setStyle({visibility: 'hidden'});",
:with => "'feb=' + $('act_feb').value",
if $('team_feb').value == true
"$('jan_reminder_').setStyle({visibility: 'visible'});"
else
"$('jan_reminder_').setStyle({visibility: 'hidden'});"
end %>
using an observe_field helper, i am saving data and making a spinner visible while updating. in addition, i would like to update a div. could it be done with a condition inside the observe_field helper like so?
<%= observe_field 'act_feb',
:url => { :controller => :prep, :action => :toggle_feb },
:method => :put,
:loading => "$('feb_spinner').setStyle({visibility: 'visible'});",
:complete => "$('feb_spinner').setStyle({visibility: 'hidden'});",
:with => "'feb=' + $('act_feb').value",
if $('team_feb').value == true
"$('jan_reminder_').setStyle({visibility: 'visible'});"
else
"$('jan_reminder_').setStyle({visibility: 'hidden'});"
end %>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以看到它位于错误的位置。如果我把它放在“:complete”后面怎么办?
I can see that it was in the wrong location for this. What if i placed it following ":complete"?