From: Christopher Burger Date: Fri, 3 Mar 2017 18:19:24 +0000 (-0500) Subject: RT# 21110, Updated files to use jquery-validate jquery plugin. This allows for field... X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=6c8a8cedc4dbfc9a9d6976718e369ed36a152670 RT# 21110, Updated files to use jquery-validate jquery plugin. This allows for field validation instead of just form validation. Also updated footer so it does not use experimental keys on scalar. Dereferenced hash ref prior to using keys. --- diff --git a/httemplate/docs/credits.html b/httemplate/docs/credits.html index 555bab402..fee15af0a 100644 --- a/httemplate/docs/credits.html +++ b/httemplate/docs/credits.html @@ -107,7 +107,7 @@ Johan Vromans
Peter Wemm
Mark Williamson
Tim Yardley
- +Jörn Zaefferer

diff --git a/httemplate/docs/license.html b/httemplate/docs/license.html index 5a824fd03..8b44630c4 100644 --- a/httemplate/docs/license.html +++ b/httemplate/docs/license.html @@ -133,6 +133,22 @@ under the terms of the MIT license. Contains the XRegExp library by Steven Levithan, licensed under the terms of the MIT license. +<<<<<<< HEAD +======= +

+Contains the Google Maps Longitude and Latitude Picker, by Richard Dancsi, +licensed under the terms of the MIT license. + +

+Contains js-cookie by Klaus Hartl, Fagner Brack and contributors, licensed +under the terms of the MIT license. + +

+Contains the form validation Jquery plugin jquery-validation + by Jörn Zaefferer, +licensed under the terms of MIT License. + +>>>>>>> f650b4e... RT# 21110, Updated files to use jquery-validate jquery plugin. This allows for field validation instead of just form validation. Also updated footer so it does not use experimental keys on scalar. Dereferenced hash ref prior to using keys.

diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 285c85265..f6bc1abb5 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -231,7 +231,7 @@ Example: % my $url = $opt{'post_url'} || popurl(1)."process/$table.html"; -% $js_form_validate = { 'edit_topform' => { 'name' => 'edit_topform', 'errormessage' => 'Please only numeric characters ' } }; +% $js_form_validate = { 'edit_topform' => { 'name' => 'edit_topform' } };

{edit_topform}{$validate_field} = 'numeric'; +% $js_form_validate->{edit_topform}->{validate_fields}{$validate_field} = 'digits: true'; +% $js_form_validate->{edit_topform}->{error_message}{$validate_field} = 'Please only enter numbers here.'; % } % % my @include = diff --git a/httemplate/elements/footer.html b/httemplate/elements/footer.html index 7f2c50ee6..f178b57c8 100644 --- a/httemplate/elements/footer.html +++ b/httemplate/elements/footer.html @@ -4,12 +4,18 @@ Example: <& /elements/footer.html, 'formname' => { #actual name of the form you want validated - 'name' => # name of the form - 'errormessage' => # js error message to display - 'fieldname' => # fieldname is actual name of field to be validated and value is type of validation - # validation types are required, valid_email, min_length(min_length[5]), max_length(max_length[7]), - # exact_length(exact_length[6]), greater_than(greater_than[4]), less_than(less_than[6]), - # alpha, alpha_numeric, numeric, valid_ip, is_file_type(is_file_type[gif,png,jpg]) + 'name' => # name of the form + 'validate_fields' => # list of key/value pairs with key being name of field to be validated and value is type + # of validation + # validation types are + # required: true, email: true, url: true, number: true, digits: true + # validation size types are + # minlength: n, maxlength: n, rangelength: [n, n] + # validation value types are + # min: n, max: n, range: [n, n], + 'error_message' => # list of key/value pairs with key being name of field to be validated and value is error + # message to display + } &> @@ -21,28 +27,29 @@ Example: % if ($opt{'formvalidation'}) { % my $form_validation = $opt{'formvalidation'}; -% foreach my $name (sort keys $form_validation) { -% my $form = $form_validation->{$name}; +% foreach my $name (sort keys %$form_validation) { +% my $validate_fields = $form_validation->{$name}->{validate_fields}; +% my $error_message = $form_validation->{$name}->{error_message}; % } % } diff --git a/httemplate/elements/header-full.html b/httemplate/elements/header-full.html index e72eec35e..3898b536c 100644 --- a/httemplate/elements/header-full.html +++ b/httemplate/elements/header-full.html @@ -47,6 +47,7 @@ Example: + % if ( $FS::CurrentUser::CurrentUser->option('printtofit') ) { % } @@ -64,8 +65,6 @@ Example: <% $head |n %> - - %# announce our base path, and the Mason comp path of this page