form:remote =>是的,在IE中提交两次 [英] form :remote => true, submitted twice in IE

查看:157
本文介绍了form:remote =>是的,在IE中提交两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表格标签如下:

      <%= form_tag(new_invitations_invitations_path, :remote => true) do %>
        <%= hidden_field_tag(:provider, "yahoo") %>
        <dl>
          <dt><strong>Your email:</strong></dt>
          <dd><%= text_field_tag('email') %></dd>
        </dl>
        <dl>
          <dt><strong>Password:</strong></dt>
          <dd><%= password_field_tag('pass') %></dd>
        </dl>
        <dl>
          <dt>&nbsp;</dt>
          <dd><%= submit_tag "Import your address book", :disable_with => "Please wait..." %></dd>
        </dl>
      <% end %>

以上输出HTML如下:

Above gives output HTML as following:

<form accept-charset="UTF-8" action="/invitations/new_invitations" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="EC+HcCqnxadujZg8CMWHGT1blQ3KoIddlnR8teWaowQ=" /></div>
  <input id="provider" name="provider" type="hidden" value="yahoo" />
  <dl>
    <dt><strong>Your email:</strong></dt>
    <dd><input id="email" name="email" type="text" /></dd>
  </dl>
  <dl>
    <dt><strong>Password:</strong></dt>
    <dd><input id="pass" name="pass" type="password" /></dd>
  </dl>
  <dl>
    <dt>&nbsp;</dt>
    <dd><input data-disable-with="Please wait..." name="commit" type="submit" value="Import your address book" /></dd>
  </dl>

当我尝试通过按提交按钮在IE中提交上述表单时,表单会提交两次。问题是,一旦提交格式为JS是正确的。一旦它作为HTML提交是错误的。由于第二次提交,我得到406不可接受的错误。

When I try to submit above form in IE by pressing the submit button, the form is submitted twice. The problem is that once it is submitted with format as JS which is correct. And once it is submitted as HTML which is wrong. Because of second submission, I get a 406 not acceptable error.

任何线索?

推荐答案

原来我在我的应用程序中使用Prototype和rails.js上的旧版本。升级解决了这个问题。

It turns out to be that I had older versions on Prototype and rails.js in my application. Upgrading solved the problem.

这篇关于form:remote =&gt;是的,在IE中提交两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆