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

  • Home
  • SEARCH
  • 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 8484215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:19:06+00:00 2026-06-10T20:19:06+00:00

When saving a form and a field fails validation, I don’t want the label

  • 0

When saving a form and a field fails validation, I don’t want the label to be modified at all.
I don’t mind wrapping the input with a div and a class of “field_with_errors”, but how can I stop it from wrapping the label as well?

  • 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-06-10T20:19:07+00:00Added an answer on June 10, 2026 at 8:19 pm

    I wasn’t able to find anything in the ActionView::Base documentation about the field_error_proc method, but here is the solution I came up with. Hopefully this will help others!

     ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| 
      unless html_tag =~ /^<label/
        "<div class=\"field_with_errors\">#{html_tag}</div>".html_safe
      else
        html_tag.html_safe
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to check during edit form saving process the value of a field
I'm looking to enable saving of form data prior to submission. I want users
when saving data from my form I get an empty date on create field
I am having issues saving the selections made in a entity form field with
I want to provide user with ability to fill-in input field with special characters
When saving a form I deactivate the save button to avoid double submission. Save
I am building an app which requires saving a form whenever user enter the
I have trouble saving my date field into database using CakePHP. Table column name
What is the best way to update a datetime field in a form. I
I have an Edit form, and have a problem when saving the result. View:

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.