From: Jo-Philipp Wich Date: Mon, 26 Apr 2010 00:00:33 +0000 (+0000) Subject: libs/cbi: always reset class name in validation handler X-Git-Tag: 0.10.0~692 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8e590d6650351a0d138b9dd6b7f06bd8e912c330;p=oweals%2Fluci.git libs/cbi: always reset class name in validation handler --- diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 200016d6e..3840456ca 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -461,6 +461,8 @@ function cbi_validate_disable_form(form, onoff) function cbi_validate_field(type, optional, field) { + field.className = field.className.replace(/ cbi-input-invalid/g, ''); + var vldcb = cbi_validators[type]; if( vldcb ) { @@ -469,7 +471,6 @@ function cbi_validate_field(type, optional, field) if( ((value.length == 0) && optional) || vldcb(value) ) { // OK - field.className = field.className.replace(/ cbi-input-invalid/g, ''); cbi_validate_disable_form(field.form, false); } else @@ -482,7 +483,6 @@ function cbi_validate_field(type, optional, field) else { // OK - field.className = field.className.replace(/ cbi-input-invalid/g, ''); cbi_validate_disable_form(field.form, false); } }