javascript validation for a form?

Hello,

I've made a form with a validation system in rails (validates_presence_of etc) but I'ld like also to make a classic validation with an external javascript to have a direct client validation without sending to the server. Is it possible?

Thanks you for your help,

How about trying live validation?

Ramon Tayag wrote:

How about trying live validation?

Posted via http://www.ruby-forum.com/.

Thanks Tayag, I didn't know live validation but that seems really interesting, I'll try this.

I've yet a question about the classic rails validation... When I add "validates_presence_of :email"; if the field "email" is empty, when the submitting I receive an error message " You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.collect'. If the field "email" is filled, the field with select .collect works perfectly?

san 1981 wrote:

Ramon Tayag wrote:

How about trying live validation?

Posted via http://www.ruby-forum.com/.

Thanks Tayag, I didn't know live validation but that seems really interesting, I'll try this.

I've yet a question about the classic rails validation... When I add "validates_presence_of :email"; if the field "email" is empty, when the submitting I receive an error message " You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.collect'. If the field "email" is filled, the field with select .collect works perfectly?

I'll say that if the field "email" is filled, the form is well submitted. I received the error message only if this field is empty.