我为我的应用程序使用 clientsidevalidations gem 和 twitter bootstrap-modal。但 vaidations 不起作用。
在 application.js 上
//= require bootstrap-modal
这是在模态对话框中显示的元素
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<%= form_for @content, :validate => true do |f| %>
<script>$('#new_content').validate()</script>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">New Content</h3>
</div>
<div class="modal-body" style = "height:600px;overflow-y: scroll;">
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :permalink, "Permalink" %><br />
<%= f.text_field :permalink %>
</div>
<div class="field">
<%= f.label :body %><br />
<%= f.text_area :body, :class => "redactor", :rows => 10, :cols => 40 %>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> atau
<%= f.submit ( "Submit" ), :class => "btn btn-inverse btn-medium" %>
</div>
</div>
<% end %>
</div>
当我检查 chrome 上的元素时
<form accept-charset="UTF-8" action="/admin/contents" class="new_content" data-validate="true" id="new_content" method="post" novalidate="novalidate">
我找到了一些解决方案,但对我没有帮助
还有其他解决方案吗?谢谢