From 140c61566b1db4ed5072cc803b846c0adcbd0838 Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 8 Mar 2019 13:31:28 +0100 Subject: [PATCH] Update form.js [form remove rule] Check if `validation[field] !== undefined` before accessing any of it's properties --- dist/components/form.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/components/form.js b/dist/components/form.js index 316cd136ec..90f57cbbab 100644 --- a/dist/components/form.js +++ b/dist/components/form.js @@ -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) {