首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >推特Bootstrap中没有显示ClientSideValidations -Modal Rails3.2

推特Bootstrap中没有显示ClientSideValidations -Modal Rails3.2
EN

Stack Overflow用户
提问于 2012-12-18 16:29:46
回答 2查看 810关注 0票数 3

我在我的应用中使用clientsidevalidations、gem和twitter bootstrap-modal。但是验证不起作用。

在application.js上

代码语言:javascript
复制
//= require bootstrap-modal

这是在模式对话框中显示的元素

代码语言:javascript
复制
<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>&nbsp;&nbsp; atau &nbsp;&nbsp;
    <%= f.submit ( "Submit" ), :class => "btn btn-inverse btn-medium" %>
  </div>

  </div>
  <% end %>

</div>

当我检查chrome上的元素时

代码语言:javascript
复制
<form accept-charset="UTF-8" action="/admin/contents" class="new_content" data-validate="true" id="new_content" method="post" novalidate="novalidate">

我找到了一些解决方案,但对我没有帮助。

solution but not working to memodal view

还有其他的解决方案吗?感谢‘s

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-12-19 02:18:25

你应该使用SimpleForm和SimpleForm的Bootstrap集成。在那里您可以使用client_side_validations-simple_form,它支持Twitter Bootstrap

票数 0
EN

Stack Overflow用户

发布于 2013-01-18 14:05:24

当附加验证处理程序时,输入字段不可见是一个问题。有关详细信息和修复方法,请参阅SimpleForm+ClientSideValidations+bootstrap - Validation is not occuring on the form- all inputs are accepted

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13929022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档