Hooking validates

I want to hook the validation routines so that I can flag html labels
and change their color to better indicate which fields need to be
corrected in a form.

Is there a way to do this conveniently and/or conventionally?

On Feb 19, 4:14 pm, Ralph S. [email protected] wrote:

I want to hook the validation routines so that I can flag html labels
and change their color to better indicate which fields need to be
corrected in a form.

Is there a way to do this conveniently and/or conventionally?

Have a look at field_error_proc

Fred

On 19 February 2010 16:14, Ralph S. [email protected] wrote:

I want to hook the validation routines so that I can flag html labels
and change their color to better indicate which fields need to be
corrected in a form.

Is there a way to do this conveniently and/or conventionally?

you can interrogate the model errors to see what fields are invalid,
but it’s easier to use a plugin that someone else has already done the
same thing in. I’ve recently used Formtastic to generate forms and the
resultant helpful, highlighted errors.

Michael P. wrote:

On 19 February 2010 16:14, Ralph S. [email protected] wrote:

I want to hook the validation routines so that I can flag html labels
and change their color to better indicate which fields need to be
corrected in a form.

Is there a way to do this conveniently and/or conventionally?

you can interrogate the model errors to see what fields are invalid,
but it’s easier to use a plugin that someone else has already done the
same thing in. I’ve recently used Formtastic to generate forms and the
resultant helpful, highlighted errors.
GitHub - formtastic/formtastic: A Rails form builder plugin with semantically rich and accessible markup.

Thanks, Michael.

I have tried formtastic and have found it more of a hassle than a help.

Maybe I’m just not seeing the benefits.


Thanks, Frederick, I’ll look at field_error_proc.