Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3 Confirm Delete - in IE8, pressing Cancel still deletes
    primarykey
    data
    text
    <p>Following Michael Hartl's tutorial. Using Rails 3.0.9 under Ubuntu. The following header is in application.html.erb:</p> <pre><code>&lt;head&gt; &lt;title&gt;&lt;%= title %&gt;&lt;/title&gt; &lt;%= csrf_meta_tag %&gt; &lt;%= render 'layouts/stylesheets' %&gt; &lt;%= javascript_include_tag :defaults %&gt; &lt;/head&gt; </code></pre> <p>No jQuery. Tutorial <a href="http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#code%3adelete_links" rel="nofollow">Listing 10.38</a> specifies the Delete action be called as follows:</p> <pre><code>&lt;%= link_to "delete", user, :method =&gt; :delete, :confirm =&gt; "You sure?", :title =&gt; "Delete #{user.name}" %&gt; </code></pre> <p>Here is an example of the generated HTML:</p> <pre><code>&lt;a href="/users/13" data-confirm="You sure?" data-method="delete" rel="nofollow" title="Delete Mylene Gaylord"&gt;delete&lt;/a&gt; </code></pre> <p>I've tested the confirmation under three browsers:</p> <ul> <li>Firefox 3 under Ubuntu: "OK" deletes user, "Cancel" does not (good)</li> <li>Firefox 5 under Win7: "OK" deletes user, "Cancel" does not (good)</li> <li>IE8 under Win7: both "OK" and "Cancel" delete user (bad!)</li> </ul> <p>When using IE8, why is Cancel calling the Delete code, and how do I fix it? Is there a way to test that Cancel does, in fact, cancel the action, no matter what browser is used?</p> <p>Update 9/29/2011: after upgrading to Rails 3.1 and converting from Prototype to jQuery (Tutorial section <a href="http://ruby.railstutorial.org/chapters/rails-3-1#sec%3aprototype_to_jquery" rel="nofollow">13.1.4</a>), IE8 behaves properly: pressing Cancel aborts the delete action. However that doesn't answer the original question of why IE8 can't Cancel the delete from Rails 3.0.9 with Prototype.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload