summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2018-01-12 15:36:13 -0500
committerChristopher Burger <burgerc@freeside.biz>2018-01-14 11:56:54 -0500
commita0ef3549089ec5806f9e489ab6e54daebb62e380 (patch)
tree04d3e5a516eb195fb5a94711c8e47d7828654754
parent3542fba5b1ec10d2632a87eff8f2beb32fc8c300 (diff)
RT# 78617 - fixed preference field customer_view_emails to only except whole numbers, also added redirection back to preference page after edit.
Conflicts: httemplate/pref/pref.html
-rw-r--r--httemplate/pref/pref-process.html1
-rw-r--r--httemplate/pref/pref.html21
2 files changed, 20 insertions, 2 deletions
diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html
index f5b5bb68e..cf0d8240f 100644
--- a/httemplate/pref/pref-process.html
+++ b/httemplate/pref/pref-process.html
@@ -4,6 +4,7 @@
% } else {
<% include('/elements/header.html', 'Preferences updated') %>
<% include('/elements/footer.html') %>
+<% $cgi->redirect(popurl(1). "pref.html?alert=Preferences updated" ) %>
% }
<%init>
diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html
index d976871f5..882975ad6 100644
--- a/httemplate/pref/pref.html
+++ b/httemplate/pref/pref.html
@@ -1,9 +1,16 @@
<% include('/elements/header.html', 'Preferences for '. getotaker ) %>
+% my $js_form_validate = { 'pref_form' => { 'name' => 'pref_form' } };
+
<FORM METHOD="POST" NAME="pref_form" ACTION="pref-process.html">
<% include('/elements/error.html') %>
+<<<<<<< HEAD
+=======
+<& /elements/alert.html &>
+
+% if ( FS::Auth->auth_class->can('change_password') ) {
<% mt('Change password (leave blank for no change)') |h %>
<% ntable("#cccccc",2) %>
@@ -156,10 +163,14 @@ Interface
</TD>
</TR>
+% my $validate_field_cve = 'customer_view_emails';
+% $js_form_validate->{pref_form}->{validate_fields}{$validate_field_cve} = 'digits: true';
+% $js_form_validate->{pref_form}->{error_message}{$validate_field_cve} = 'Please only enter numbers here.';
+
<TR>
<TH ALIGN="right">How many recent outbound emails to show in customer view</TH>
<TD ALIGN="left" COLSPAN=2>
- <INPUT TYPE="text" NAME="customer_view_emails" VALUE="<% $curuser->option('customer_view_emails') %>"></TD>
+ <INPUT TYPE="text" ID="<% $validate_field_cve %>" NAME="<% $validate_field_cve %>" VALUE="<% $curuser->option('customer_view_emails') %>"></TD>
</TD>
</TR>
@@ -273,7 +284,13 @@ Vonage integration (see <a href="https://secure.click2callu.com/">Click2Call</a>
<INPUT TYPE="submit" VALUE="Update preferences">
-<% include('/elements/footer.html') %>
+% my %footerdata = (
+% 'formvalidation' => $js_form_validate,
+% );
+<% include("/elements/footer.html", %footerdata) %>
+
+%#<&/elements/footer.html &>
+
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;