Skip to content

Commit 65ff640

Browse files
Giorgos SaslisGiorgos Saslis
authored andcommitted
In some cases, it is useful to be able to validate hidden fields in a
form. This is particularly true in the case of jquery-UI tabs, if you have a single form split over multiple tabs. By adding an option about whether we want to validate hidden fields in a form, we can override the default behaviour when we need to, while at the same time maintaining the original behaviour by default.
1 parent bdb07e6 commit 65ff640

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

js/jquery.validationEngine.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@
492492
++$.validationEngine.fieldIdCounter;
493493
}
494494

495-
if (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden"))
495+
if (!options.validateNonVisibleFields && (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden")))
496496
return false;
497497

498498
var rulesParsing = field.attr(options.validateAttribute);
@@ -1892,6 +1892,8 @@
18921892
focusFirstField:true,
18931893
// Show prompts, set to false to disable prompts
18941894
showPrompts: true,
1895+
// Should we attempt to validate non-visible input fields contained in the form? (Useful in cases of tabbed containers, e.g. jQuery-UI tabs)
1896+
validateNonVisibleFields: false,
18951897
// Opening box position, possible locations are: topLeft,
18961898
// topRight, bottomLeft, centerRight, bottomRight
18971899
promptPosition: "topRight",

0 commit comments

Comments
 (0)