Unified form validation handling

This commit is contained in:
Bernd Bestel
2022-03-30 18:00:28 +02:00
parent 77d75d16df
commit fbb84277bf
29 changed files with 72 additions and 82 deletions

View File

@@ -506,11 +506,11 @@ $('#consume-form select').change(function(event)
$('#consume-form input').keydown(function(event)
{
if (event.keyCode === 13) //Enter
if (event.keyCode === 13) // Enter
{
event.preventDefault();
if (document.getElementById('consume-form').checkValidity() === false) //There is at least one validation error
if (!Grocy.FrontendHelpers.ValidateForm('consume-form'))
{
return false;
}
@@ -707,8 +707,7 @@ function ScanModeSubmit(singleUnit = true)
$(".input-group-productamountpicker").trigger("change");
}
Grocy.FrontendHelpers.ValidateForm("consume-form");
if (document.getElementById("consume-form").checkValidity() === true)
if (Grocy.FrontendHelpers.ValidateForm('consume-form'))
{
$('#save-consume-button').click();
}