如何使用 formastic 和 activeadmin 添加 javascript 操作:
我有这样的表格:
f.input :role, :as => :select, :collection => User.display_roles.each_with_index.map{|x,i| [x,User.roles[i]]} , :include_blank => nil
f.input :organization, :input_html => { :disabled => false }
我想添加 javascript,在更改角色后,组织会发生变化。怎么做??
最佳答案
我必须创建一个部分表单。
在部分放置的末尾:
<script type="text/javascript">
$(function(){
$('#your_model_role').change(function() {
what you want to happen goes here
});
});
</script>
希望对您有所帮助。
关于ruby-on-rails - Formastic,ActiveAdmin 添加 javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14463704/