# Help with Validation errors

**URL:** <https://www.ruby-forum.com/t/help-with-validation-errors/82968>\
**Category:** Rails\
**Created:** [January 22, 2007, 7:55pm UTC](https://www.ruby-forum.com/t/help-with-validation-errors/82968 "2007-01-22T19:55:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kim](https://www.ruby-forum.com/u/kim)\
**Post date:** [January 22, 2007, 7:55pm UTC](https://www.ruby-forum.com/t/help-with-validation-errors/82968/1 "2007-01-22T19:55:21Z")

</div>

I have a file field in the DB I want to be unique. In my form I have  
the user select items from drop-downs and enter text in text boxes, the  
file name is then made up of the values in these fields.

I am using validate\_presence\_of to make sure the user enters info into  
all the fields. When a user does not enter info, an error is returned  
and the field is highlighted with red.

I am using validate\_uniqueness\_of :file to ensure the file name is  
unique. When it is not unique, an error is returned but no fields are  
hightlighted.

I want to highlight the fields that comprise the file name. Is there a  
way to tell the validation which fields to highlight?

Code examples are always helpful.  
Thanks in advance - K

---

<div class="post-metadata">

**Author:** ![kim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kim](https://www.ruby-forum.com/u/kim)\
**Post date:** [January 23, 2007, 12:11am UTC](https://www.ruby-forum.com/t/help-with-validation-errors/82968/2 "2007-01-23T00:11:15Z")

</div>

Hello - anyone know how to do this? Am I explaining myself OK?

---

<div class="post-metadata">

**Author:** ![kim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kim](https://www.ruby-forum.com/u/kim)\
**Post date:** [January 23, 2007, 6:47pm UTC](https://www.ruby-forum.com/t/help-with-validation-errors/82968/3 "2007-01-23T18:47:33Z")

</div>

Bump.Is there a way to do this?
