Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7527755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:11:04+00:00 2026-05-30T04:11:04+00:00

When an input doesn’t pass validation, an error label appears after the input but

  • 0

When an input doesn’t pass validation, an error label appears after the input but the first label that holds inputs name disappears. Any ideas? Thanks.

before validation

<div class="field">
 <label class="default-label" for="user_email">Email</label>
 <input class="default-input" id="user_email" name="user[email]" size="30" type="email" value="" />
</div>

after validation

<div class="field">
 <div class="field_with_errors">
  <input class="default-input" id="user_email" name="user[email]" size="30" type="email" value="" />
  <label for="user_email" class="message">has already been taken</label>
 </div>
</div

_form.html.erb

<%= form_for @user, :validate => true, :url => users_path, :method => :post do |f| %>

 <div class="field"><%= f.label :email,  { :class => "default-label" } %>
 <%= f.text_field :email,  { :class => "default-input" }  %></div>

 <div class="actions"><%= f.submit "Go!", :class => "default-button" %></div>

<% end %>

initializers/client_side_validations.rb

require 'client_side_validations/simple_form' if defined?(::SimpleForm)
require 'client_side_validations/formtastic'  if defined?(::Formtastic)

ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
  unless html_tag =~ /^<label/
    %{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
  else
    %{<div class="field_with_errors">#{html_tag}</div>}.html_safe
  end
end

Gems

  • rails 3.1.0
  • client_side_validations 3.1.0
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:11:06+00:00Added an answer on May 30, 2026 at 4:11 am

    I had the same issue in my project and I found this issue on the github repository

    I used the fork proposed there and everything worked fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want my errors to float above, left-justified, the input field that doesn't validate.
It seems that flex doesn't support UTF-8 input. Whenever the scanner encounter a non-ASCII
I've got some code that works great in FireFox, but in IE, the input
I'm creating a browser-based form verification script that checks if the input doesn't have
following code doesn't work with input: 2 7 add Elly 0888424242 add Elly 0883666666
I'm trying to check if a form input has any value (doesn't matter what
How can I write regular expression in C# to validate that the input does
I just downloaded 2.2.1 and i've seen that my input view does not adjust
does jquery have any plugin that prevents entering any input to a textbox that
So right now I have an input validation method structured something like this: function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.