# Custom select still wrapped in fieldWithErrors?

**URL:** <https://www.ruby-forum.com/t/custom-select-still-wrapped-in-fieldwitherrors/141470>\
**Category:** Rails\
**Created:** [June 26, 2008, 5:31am UTC](https://www.ruby-forum.com/t/custom-select-still-wrapped-in-fieldwitherrors/141470 "2008-06-26T05:31:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danimal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@Danimal](https://www.ruby-forum.com/u/Danimal)\
**Post date:** [June 26, 2008, 5:31am UTC](https://www.ruby-forum.com/t/custom-select-still-wrapped-in-fieldwitherrors/141470/1 "2008-06-26T05:31:23Z")

</div>

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
