I noticed today that if I build my own <select …> tag, even with the
right id, it doesn’t get wrapped in the fieldWithErrors div on a
validation error. If, I use one of the select or collection_select
helpers, it does get wrapped (so my custom CSS kicks in).
I’m wondering: is there a way to force the fieldWithErrors wrapping?
I would use a helper but I have a complex select with optgroup values
and custom-built values so I don’t know if I can.
Just on the off-chance that someone wants to take a crack, the dataset
I’m putting into the select is an array of people objects, but each of
them is grouped by a type field because I have STI-style objects:
Guest, Member, Admin, SuperAdmin (for example). And I want to group by
the type, so the optgroup values are the types and then under each are
the users of that type.
Thoughts on either? (getting the fieldWithErrors div to wrap around
it, and/or getting the select built with helpers instead of by hand)
-Danimal