X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fcontact.html;h=199f5cb535ac493aaf1d86837124bdc02efa7ed8;hb=088d455c563ca3b75be357727622d968e49b3ed1;hp=a915a587667fb73eb7d189382234cd4cd8bd537f;hpb=741c37dc7259c25f4229fbeeeb28231b4a99ecbc;p=freeside.git diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index a915a5876..199f5cb53 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -1,4 +1,6 @@ -% unless ( $opt{'js_only'} ) { +% if ( $opt{'js_only'} ) { +<% $js %> +% } else { @@ -70,25 +72,8 @@ VALUE = "" placeholder = "<% $value |h %>" > -% my $contactnum = $curr_value ? $curr_value : '0'; - <& '/elements/validate_password.html', - 'fieldid' => "changepw".$id."_password", - 'svcnum' => '', - 'contactnum' => $contactnum, - 'submitid' => "submit", - &> - - % } elsif ( $field eq 'invoice_dest' ) { % my $curr_value = $cgi->param($name . '_' . $field); @@ -113,7 +98,7 @@
<% $label{$field} %> % if ( $field eq 'password' ) { -
+
% } % } @@ -133,6 +118,7 @@ my $name = $opt{'element_name'} || $opt{'field'} || 'contactnum'; my $id = $opt{'id'} || 'contactnum'; my $curr_value = $opt{'curr_value'} || $opt{'value'}; +my $contactnum = $curr_value ? $curr_value : '0'; my $onchange = ''; if ( $opt{'onchange'} ) { @@ -179,4 +165,21 @@ $label{'comment'} = 'Comment'; my @fields = $opt{'name_only'} ? qw( first last ) : keys %label; +my $submitid = $opt{'submit_id'} ? $opt{'submit_id'} : 'submit'; + +my $js = qq( + add_password_validation('changepw$id\_password', '$submitid', '', '$contactnum'); + + var selfService = document.getElementById("$id\_selfservice_access").value; + + if (selfService !== "Y") { document.getElementById("changepw$id\_password").disabled = 'true'; } + document.getElementById("$id\_selfservice_access").onchange = function() { + if (this.value == "P" || this.value == "E" || this.value =="Y") { + document.getElementById("changepw$id\_password").disabled = ''; + } + else { document.getElementById("changepw$id\_password").disabled = 'true'; } + return false; + } +); +