Skip to content

Commit

Permalink
Update form.js
Browse files Browse the repository at this point in the history
[form remove rule] Check if `validation[field] !== undefined` before accessing any of it's properties
  • Loading branch information
iarspider authored Mar 8, 2019
1 parent 6a7360e commit 140c615
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dist/components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,12 @@ $.fn.form = function(parameters) {
? rule
: [rule]
;
if(rule == undefined) {
module.debug('Removed all rules');
validation[field].rules = [];
if(validation[field] === undefined || !Array.isArray(validation[field].rules)) {
return;
}
if(validation[field] == undefined || !Array.isArray(validation[field].rules)) {
if(rule === undefined) {
module.debug('Removed all rules');
validation[field].rules = [];
return;
}
$.each(validation[field].rules, function(index, rule) {
Expand Down

0 comments on commit 140c615

Please sign in to comment.