Bug 34169: Use jQuery validator plugin to validate amounts

This is a first step towards more consistency and possibly supporting
multiple input formats as well in the future. It allows us to mark all
input fields for monetary values, such as prices, replacement prices,
fees etc. with a class that is linked to a check for the 'number' format
in the jQuery Validator plugin.

This is the base patch that does nothing by itself, please see
test plan in second patch.

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Katrin Fischer 2023-07-14 15:42:46 +00:00 committed by Tomas Cohen Arazi
parent 5de1c66fe1
commit 6b2308c17b
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 4 additions and 0 deletions

View file

@ -11,6 +11,7 @@
number: _("Please enter a valid number."),
digits: _("Please enter only digits."),
equalTo: _("Please enter the same value again."),
number: _("Please add amount in valid format: 0.00"),
maxlength: $.validator.format(_("Please enter no more than {0} characters.")),
minlength: $.validator.format(_("Please enter at least {0} characters.")),
rangelength: $.validator.format(_("Please enter a value between {0} and {1} characters long.")),

View file

@ -110,6 +110,9 @@ $(document).ready(function() {
$(".validated").each(function() {
$(this).validate();
});
jQuery.validator.addClassRules("decimal", {
number: true
});
$("#logout").on("click",function(){
logOut();