summaryrefslogtreecommitdiff
path: root/httemplate/elements/validate_password.html
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-07-06 11:52:22 -0400
committerChristopher Burger <burgerc@freeside.biz>2017-07-06 11:52:22 -0400
commit59776b97e0d82e30e9a50c76d16f302309fff76d (patch)
tree40312c609a9e1ff36d759d503ef0948c7e7a3d31 /httemplate/elements/validate_password.html
parent53427a0d7b74c16d646196e70c95971471e1fae8 (diff)
RT# 75817 - fixed contact password page to be more consistant with svc password page, updated javascript to check password as you type rather than when you leave the field.
Diffstat (limited to 'httemplate/elements/validate_password.html')
-rw-r--r--httemplate/elements/validate_password.html10
1 files changed, 7 insertions, 3 deletions
diff --git a/httemplate/elements/validate_password.html b/httemplate/elements/validate_password.html
index bd385a6ca..3d23a552c 100644
--- a/httemplate/elements/validate_password.html
+++ b/httemplate/elements/validate_password.html
@@ -20,9 +20,9 @@ should be the input id plus '_result'.
'method' => 'POST', # important not to put passwords in url
&>
<SCRIPT>
-function add_password_validation (fieldid) {
+function add_password_validation (fieldid, submitid) {
var inputfield = document.getElementById(fieldid);
- inputfield.onchange = function () {
+ inputfield.onkeyup = function () {
var fieldid = this.id+'_result';
var resultfield = document.getElementById(fieldid);
if (this.value) {
@@ -36,11 +36,14 @@ function add_password_validation (fieldid) {
var validimg = '<IMG SRC="<% $p %>images/tick.png" style="width: 1em; display: inline-block; padding-right: .5em">';
if (result.valid) {
resultfield.innerHTML = validimg+'<SPAN STYLE="color: green;">Password valid!</SPAN>';
+ if (submitid){ document.getElementById(submitid).disabled = false; }
} else if (result.error) {
resultfield.innerHTML = errorimg+'<SPAN STYLE="color: red;">'+result.error+'</SPAN>';
+ if (submitid){ document.getElementById(submitid).disabled = true; }
} else {
result.syserror = result.syserror || 'Server error';
resultfield.innerHTML = errorimg+'<SPAN STYLE="color: red;">'+result.syserror+'</SPAN>';
+ if (submitid){ document.getElementById(submitid).disabled = true; }
}
}
}
@@ -50,7 +53,8 @@ function add_password_validation (fieldid) {
}
};
}
-add_password_validation('<% $opt{'fieldid'} %>');
+
+add_password_validation('<% $opt{'fieldid'} %>', '<% $opt{'submitid'} %>');
</SCRIPT>
<%init>