开发者

Jquery Validate not Working Well with HTML 5?

开发者 https://www.devze.com 2023-03-22 08:38 出处:网络
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 wi

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!


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|


Update:

I got this from the link by ig0774

This solved the problem!

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

0

精彩评论

暂无评论...
验证码 换一张
取 消