Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

fields with errors do not get wrapped in fieldWithErrors

#4405

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.

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

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Mike (at coverallcrew)
    Mike (at coverallcrew)

    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.

    April 15th, 2010 @ 05:13 PM

  2. Mike (at coverallcrew)
    Mike (at coverallcrew)

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

    April 15th, 2010 @ 05:46 PM

  3. Mike (at coverallcrew)
    Mike (at coverallcrew)
    • 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!

    April 15th, 2010 @ 06:39 PM

  4. Mike (at coverallcrew)
    Mike (at coverallcrew)

    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.

    April 15th, 2010 @ 07:49 PM

  5. Foobear
    Foobear

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

    April 16th, 2010 @ 10:18 AM

  6. Rizwan Reza
    Rizwan Reza
    • State changed from new to invalid

    Mike, send a pull request after fixing the bug to nex3: http://github.com/nex3/haml

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

    May 15th, 2010 @ 10:27 AM