summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index 5a095bdfd..9b391c782 100644
--- a/modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js
@@ -228,7 +228,7 @@ var CBIValidatorPrototype = {
validate: function() {
/* element is detached */
- if (!this.field.form)
+ if (!findParent(this.field, 'form'))
return true;
this.field.classList.remove('cbi-input-invalid');
@@ -1124,10 +1124,12 @@ function cbi_validate_field(cbid, optional, type)
};
if (validatorFn !== null) {
- if (!field.form.cbi_validators)
- field.form.cbi_validators = [ ];
+ var form = findParent(field, 'form');
- field.form.cbi_validators.push(validatorFn);
+ if (!form.cbi_validators)
+ form.cbi_validators = [ ];
+
+ form.cbi_validators.push(validatorFn);
field.addEventListener("blur", validatorFn);
field.addEventListener("keyup", validatorFn);