X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.Validator.js;h=bc19ee537f4dcd7888c1a1806b3161764155d473;hb=ca7dfd3e8ceb7336233be5f3197c1f11f6989428;hp=b1bc87c765040cfdf6a787ceee4294134287979d;hpb=8a773988e22beaeb47d71302749f3507286c0476;p=kivitendo-erp.git diff --git a/js/kivi.Validator.js b/js/kivi.Validator.js index b1bc87c76..bc19ee537 100644 --- a/js/kivi.Validator.js +++ b/js/kivi.Validator.js @@ -34,6 +34,8 @@ namespace("kivi.Validator", function(ns) { for (var test_idx in tests) { var test = tests[test_idx]; + if (!ns.checks[test]) + continue; if (ns.checks[test]) { if (!ns.checks[test]($e)) @@ -102,6 +104,27 @@ namespace("kivi.Validator", function(ns) { ns.annotate($e); return true; } + }, + time: function($e) { + var time_string = $e.val(); + + var parsed_time = kivi.parse_time(time_string); + if (parsed_time === null) { + $e.val(''); + ns.annotate($e); + return true; + } else + if (parsed_time === undefined) { + ns.annotate($e, kivi.t8('Wrong time format (#1)', [ kivi.myconfig.timeformat ])); + return false; + } else + { + var formatted_time = kivi.format_time(parsed_time); + if (formatted_time != time_string) + $e.val(formatted_time); + ns.annotate($e); + return true; + } } };