gpt4 book ai didi

ruby-on-rails - ClientSideValidations 未显示在 Twitter Bootstrap-Modal Rails 3.2 中

转载 作者:行者123 更新时间:2023-12-01 11:48:13 25 4
gpt4 key购买 nike

我为我的应用程序使用 clientsidevalidations gem 和 twitter bootstrap-modal。但验证无效。

在 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>&nbsp;&nbsp; atau &nbsp;&nbsp;
<%= 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">

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

solution but not working to memodal view

还有其他解决办法吗?谢谢

最佳答案

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

关于ruby-on-rails - ClientSideValidations 未显示在 Twitter Bootstrap-Modal Rails 3.2 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13929022/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com