gerky
gerky

Reputation: 6417

Jquery Validate not Working Well with HTML 5?

I'm a newbie on Rails and Javascipt.

I've been having trouble using Jquery validate on email fields because of HTML 5 validation blocking jquery validate plugin (the email field gets red outline with no messages). So I have 2 questions.

1.) I have this form (from devise), how do I add novalidate to this?

= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|

2.) I've also tried adding novalidate using javascript,the email field only gets validated when the form is submitted, not on focus out (which is what I want), but the other field validations are just fine. Does anyone have the same problem?

Thanks in advance!

Upvotes: 3

Views: 1451

Answers (2)

gerky
gerky

Reputation: 6417

Update:

I got this from the link by ig0774

This solved the problem!

https://github.com/jzaefferer/jquery-validation/pull/108/files

Upvotes: 0

Vasiliy Ermolovich
Vasiliy Ermolovich

Reputation: 24617

There is novalidate attribute:

The novalidate attribute specifies that the form should not be validated when submitted.

form_for(resource, 
         :as => resource_name, 
         :url => 
         registration_path(resource_name), 
         :html => {:novalidate => 'novalidate'}) do |f|

Upvotes: 1

Related Questions