From 48d03455f016d5652676a6f6407e96c324d248c2 Mon Sep 17 00:00:00 2001
From: ruado1987
Date: Sat, 23 Mar 2013 14:14:53 +0800
Subject: [PATCH] Fixes issue 401 which causes error when nested form created
programatically by code or third-party library
---
jquery.validate.js | 5 +++++
test/index.html | 4 ++++
test/test.js | 12 ++++++++++++
3 files changed, 21 insertions(+)
diff --git a/jquery.validate.js b/jquery.validate.js
index c86bf6abe..d94cd25ff 100644
--- a/jquery.validate.js
+++ b/jquery.validate.js
@@ -480,6 +480,11 @@ $.extend($.validator, {
console.error( "%o has no name assigned", this);
}
+ // ignore elements of nested forms
+ if ( this.form !== validator.currentForm ) {
+ return false;
+ }
+
// select only the first element for each name, and only those with rules specified
if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
return false;
diff --git a/test/index.html b/test/index.html
index bb9fc4ad8..52ceecf6e 100644
--- a/test/index.html
+++ b/test/index.html
@@ -318,6 +318,10 @@
+
+
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.