Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3 - Displaying errors when Data-Remote is True
    primarykey
    data
    text
    <p>I have this form </p> <pre><code>&lt;div id="login"&gt; &lt;h4&gt;Please log in with your email address&lt;/h4&gt; &lt;%= form_for(@user, id: "login", remote: true) do |f| %&gt; &lt;% if @user.errors.any? %&gt; &lt;div id="error_explanation"&gt; &lt;h2&gt;&lt;%= pluralize(@user.errors.count, "error") %&gt; prohibited this user from being saved:&lt;/h2&gt; &lt;ul&gt; &lt;% @user.errors.full_messages.each do |msg| %&gt; &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; &lt;/div&gt; &lt;% end %&gt; &lt;div class="field"&gt; &lt;%= f.label :name %&gt;&lt;br /&gt; &lt;%= f.text_field :name %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :email %&gt;&lt;br /&gt; &lt;%= f.text_field :email %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :company %&gt;&lt;br /&gt; &lt;%= f.text_field :company %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :phone %&gt;&lt;br /&gt; &lt;%= f.text_field :phone %&gt; &lt;/div&gt; &lt;div class="field"&gt; &lt;%= f.label :address %&gt;&lt;br /&gt; &lt;%= f.text_field :address %&gt; &lt;/div&gt; &lt;div class="actions"&gt; &lt;%= f.submit id: "signup_submit" %&gt; &lt;/div&gt; &lt;% end %&gt; &lt;script&gt; $("#signup_submit").bind("ajaxSend", function(){ alert('start'); }).bind("ajaxComplete", function(){ alert('end'); }); &lt;/script&gt; &lt;/div&gt; </code></pre> <p>So I have data-remote set to true, and I am having a hard time displaying the errors that otherwise work when it degrates to HTTP requests.</p> <p>I am sure this is simple and would appreciate any help.</p> <p>Thanks.</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.
    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