【问题标题】:Rails submit button not working in Internet ExplorerRails 提交按钮在 Internet Explorer 中不起作用
【发布时间】:2011-11-26 12:40:44
【问题描述】:

我一直在处理的奇怪问题令人沮丧。我的一个编辑视图上的提交按钮在 Internet Explorer 中不起作用。这是一个非常标准的布局,使用 input type = submit(不是自定义的 button_to 或其他东西)。

  • 该按钮在 Mac 和 Windows 上的 Safari、Chrome 和 Firefox 中都能正常工作。
  • 编辑提交按钮在 IE 的其他页面上工作正常
  • 使用nested_form_for,与:html => {:multipart => true}

提交按钮 "post_button")%>

是否有人遇到过提交按钮在 IE 中不起作用的问题?

== 更新 ==
更新了 jQuery 以确保它不是 nested_form 问题。我实际上认为在我添加嵌套表单之前链接可能无法正常工作。但是,它一直是多部分的形式。

查看

 <head>
<%= stylesheet_link_tag 'profile' %>
    <%= javascript_include_tag "jquery.min", "nested_form"  %>
</head>
<%= nested_form_for(@profile, :html => {:multipart => true}) do |f| %>
<div class="content">
    <div class="editprofilesub">
    <div class="profile_title"> basic </div>
        <table>
            <tr>
                <td class="profileformright"> 
                    <%= f.label :firstname, "First Name" %>
                </td>
                <td class="profileformleft">
                    <%= f.text_field :firstname, :class => "profilefield", :class=>"profilefield"  %>
                </td>
            </tr>
            <tr>
                <td class="profileformright">       
                    <%= f.label :lastname, "Last Name" %>
                </td>
                <td class="profileformleft">                
                    <%= f.text_field :lastname, :class => "profilefield"   %>
                </td>
            </tr>
            <td class="profileformright">       
                <%= f.label :avatar, "User Image" %><br>
            </td>
            <td class="profileformleft">    
                <i>Please rotate images prior to uploading.</i> <br>        
                <%= f.file_field :avatar%>
            </td>           
            </table>                        

    <div class="profile_title"> location </div>
        <table>
            <tr>
                <td class="profileformright">
                    <%= f.label :city %>
                </td>
                <td class="profileformleft">    
                     <%= f.text_field :city, :class => "profilefield" %>
                </td>
            </tr>
        </table>
        <br>
            <table> 
                <tr>
                    <td class="profileformright">               
                <%= f.label :state, "State"  %>
                    </td>
                    <td class="profileformleft">
                <%= f.select :state,  Carmen.state_names(),{}, :class=> "state" %>
                </tr>
            </table>
            <div class="profile_title"> about </div>
            <table> 
                <tr>
                    <td class="profileformright">
                        <%= f.label :bio, "about" %>
                    </td>
                    <td class="profileformleft">
                        <%= f.text_area :bio, :rows => '5', :cols => '60', :class => "profilefield"   %><br>
                    </td>
                </tr>
        <tr>
            <td class="profileformright">
                <%= f.label :dob, "Date of Birth" %>
            </td>
            <td class="profileformleft">
            <%= f.date_select :dob,
                {:start_year => Time.now.year,
                  :end_year => 1900,
                                 :order => [:month, :day, :year]}%>
            </td>
        </tr>
        </table>
    </div>
    <div class="right">
        <%= f.submit("update", :class=>"post_button")%>
    </div>
</div>
<%end%>

【问题讨论】:

  • 嗨@sannankhalid,我添加了视图。谢谢您的帮助。关于可能导致 IE 出现问题的任何想法?

标签: ruby-on-rails-3 internet-explorer submit


【解决方案1】:

我刚刚在我的非 MVC 应用程序中发现了一个类似的问题,在 IE8 及以下版本中。使用 enter 时,未执行提交按钮的服务器端单击处理程序。问题是 IE 在使用 enter 时不会发布提交按钮(但在单击它时会发布)。因此,.NET 知道这是回发,但不知道是什么控制导致的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-17
    • 2010-09-25
    • 2015-10-19
    • 1970-01-01
    • 1970-01-01
    • 2015-02-01
    相关资源
    最近更新 更多