This project is archived and is in readonly mode.

#4405 ✓invalid
Mike (at coverallcrew)

fields with errors do not get wrapped in fieldWithErrors

Reported by Mike (at coverallcrew) | April 15th, 2010 @ 03:45 PM

ActiveModel form_for does not call field_error_proc when there is an error on the field.

input's work fine. Labels, select lists fail.

This results in labels not being highlighted.

Please note, when using ActiveRecord this does not appear to be an issue.

Comments and changes to this ticket

  • Mike (at coverallcrew)

    Mike (at coverallcrew) April 15th, 2010 @ 05:13 PM

    After some hackery I found that adding label_tag to the array in the module: ActionView::Helpers::ActiveModelInstanceTag (/lib/actionview/helpers/active_model_helper) allowed the label errors to be highlighted.

    Still cannot get select lists to be highlighted.

  • Mike (at coverallcrew)

    Mike (at coverallcrew) April 15th, 2010 @ 05:46 PM

    Attached a patch that allows the label to be highlighted if there is a validation error.

  • Mike (at coverallcrew)

    Mike (at coverallcrew) April 15th, 2010 @ 06:39 PM

    • Tag changed from activemodel, label to activemodel, haml, label

    I'm may be barking up the wrong tree here...

    This error only seems to happen when HAML is in the picture. The reason I thought ActiveRecord was unaffected is because I was using erb.

    Any Rails 3 + Haml gurus out there - finding someone who can fix this is going to be harder than finding the actual bug!

  • Mike (at coverallcrew)

    Mike (at coverallcrew) April 15th, 2010 @ 07:49 PM

    For what it's worth here is the patch with the Haml "fix". I have a monkey patch in my code that does this. It seems that Haml is what needs fixin' Rails 3 works just fine for this.

  • Foobear

    Foobear April 16th, 2010 @ 10:18 AM

    Yes, this is an issue of HAML 2.2.23 -- 2.2.22 works as expected.
    (Rails 2.3.5 here)

  • Rizwan Reza

    Rizwan Reza May 15th, 2010 @ 10:27 AM

    • State changed from “new” to “invalid”

    Mike, send a pull request after fixing the bug to nex3:

    I'm closing this since this is not a Rails 3 issue. Reply if otherwise.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>