# Form errors (highlight)

**URL:** <https://www.ruby-forum.com/t/form-errors-highlight/179062>\
**Category:** Rails\
**Created:** [November 16, 2009, 9:05pm UTC](https://www.ruby-forum.com/t/form-errors-highlight/179062 "2009-11-16T21:05:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![introvert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/c37758/32.png) [@introvert](https://www.ruby-forum.com/u/introvert)\
**Post date:** [November 16, 2009, 9:05pm UTC](https://www.ruby-forum.com/t/form-errors-highlight/179062/1 "2009-11-16T21:05:02Z")

</div>

Hello,

How can I force the rails so that it would know which fields to  
highlight when I use the selectbox for posting bad id to the server, for  
instance:

Review Model:

class Review \< ActiveRecord::Base  
belongs\_to :article

validates\_presence\_of :article #or :article\_id ??  
validates\_associated :article  
validates\_existence\_of :article

end

The View:

\<% form\_for @review do |f| %\>

\<%= f.label :article %\>  
  
\<%=  
f.collection\_select(:article\_id, Article.all, :id, :name, {:prompt =\>  
true})  
%\>

\<% end %\>

When I specify bad value to the select box, rails will only highlight  
label (:article) and wont highlight the :article\_id select box. How can  
I force it / let it know that its the brother-field so that both would  
be highlighted?

Thanks for help!
