Newbie AJAX validation problem. How do I validate field and


#1

I want to validate a field via AJAX in my Rails application. If there
is an error, I want to set an error class on the text field and give
it class=“error” to color it appropriately in CSS.

I’ve been looking at
<%= observe_field ‘fieldname’,
:update => ‘another_fieldname’,
:url => {:action => “validate”}
%>

This requires me to put the notification in another field. But what I
really want here is to update the same field, and it’s CSS class.

Could you point me to a function that could do this?

THANKS!


Jesper Rønn-Jensen
Capgemini Danmark A/S
Oernegaardsvej 16
DK - 2820 Gentofte
Denmark

+45 23 73 62 20 (Mobile)
Blog: http://justaddwater.dk/ - Instant usability and web standards