views:

50

answers:

3

I have a simple scaffold rails application that is doing validataes_presence_of.

The validation is making each textfield bordered. I just want the error messages to be displayed on top.

How can I make these type of changes or color changes to the validation

A: 

Have you checked rails guide about validation errors?

MBO
+1  A: 

Rails applications store their CSS in [application_root]/public/stylesheets. A new rails app will have a file called default.css in this directory. This file contains the following:

#errorExplanation {
  width: 400px;
  border: 2px solid red;
  padding: 7px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  background-color: #f0f0f0;
}

#errorExplanation h2 {
  text-align: left;
  font-weight: bold;
  padding: 5px 5px 5px 15px;
  font-size: 12px;
  margin: -7px;
  background-color: #c00;
  color: #fff;
}

#errorExplanation p {
  color: #333;
  margin-bottom: 0;
  padding: 5px;
}

#errorExplanation ul li {
  font-size: 12px;
  list-style: square;
}

If you play about with the values of some of the parameters here - in particular border - you might find something that looks more to your taste.

grifaton
A: 

I would suggest having a look at Formtastic. Easy to setup, works great with scaffold-type apps and has some nice clean HTML and CSS.

Toby Hede