X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/4cc35cdc3c6ffc31439f672c47e1d5587e69536e..53593baa211863fbf66540cf1bcc36c8fb37257f:/js/kivi.Validator.js diff --git a/js/kivi.Validator.js b/js/kivi.Validator.js index b564ffb78..4d03451b1 100644 --- a/js/kivi.Validator.js +++ b/js/kivi.Validator.js @@ -142,6 +142,26 @@ namespace("kivi.Validator", function(ns) { ns.annotate($e_annotate); return true; } + }, + trimmed_whitespaces: function($e, $e_annotate) { + $e_annotate = $e_annotate || $e; + + var string = $e.val(); + + if ($e.hasClass('tooltipstered')) + $e.tooltipster('destroy'); + + if (string.match(/^\s|\s$/)) { + $e.val(string.trim()); + + $e.tooltipster({ + content: kivi.t8("Leading and trailing whitespaces have been removed."), + contentAsHTML: true, + theme: 'tooltipster-light', + }); + $e.tooltipster('show'); + } + return true; } };