Doint something with each field in form as it is entered

Is there a callback or some mechanism that will allow me to modify a
view once a field in a form is finished … asumming that there are
multiple fields in a form.

As a silly example, let’s say the bacground of the filed is white by
default … but once the user goes on to the next field, then make the
background of that field red if the number of characters in the field is
even.

On Sat, Jan 30, 2010 at 2:02 PM, Ralph S. [email protected]
wrote:

Is there a callback or some mechanism that will allow me to modify a
view once a field in a form is finished … asumming that there are
multiple fields in a form.

As a silly example, let’s say the bacground of the filed is white by
default … but once the user goes on to the next field, then make the
background of that field red if the number of characters in the field is
even.

Well this would almost certainly have to be done in the browser using
JavaScript so it’s not really a Rails question.

Most Rails apps use either the Prototype JavaScript framework (since
that’s what the ajax helpers use), although the modern trend seems to
be to use jQuery (and Rails 3 will make changing JavaScript frameworks
much easier).

If you google for

prototype field validation
and
jquery field validation

you’ll come up with serveral plugins for both frameworks.


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs