【问题标题】:Showing errors in modals在模态中显示错误
【发布时间】:2012-06-05 07:02:57
【问题描述】:
我正在使用 Twitter Bootstrap 中的模式进行弹出式登录和注册。所以我想做,当有人输入错误的输入时,它不应该重定向到另一个页面,而是显示这个有错误的登录模式。
所以我有这个弹出登录的代码:
<a class="btn" data-toggle="modal" href="#login"">Login</a>
<div class="modal hide" id="login">
<%= render :template => "devise/sessions/new" %>
</div>
有人可以建议我怎么做吗?
【问题讨论】:
标签:
authentication
twitter-bootstrap
modal-dialog
【解决方案1】:
当登录凭据与模式 JavaScript 方法错误时,您应该激活模式:$("div.modal").modal(options); 其中 options 是这样的 JSON 对象
{
backdrop: true, // Includes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn't close the modal on click.
keyboard: true, // Closes the modal when escape key is pressed
show: true // Shows the modal when initialized.
}