mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 03:40:10 +00:00
Improved form validation handling (closes #1836)
This commit is contained in:
@@ -497,6 +497,11 @@ $('#save-add-recipe-button').on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
if (!Grocy.FrontendHelpers.ValidateForm("add-recipe-form", true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($(".combobox-menu-visible").length)
|
||||
{
|
||||
return;
|
||||
@@ -543,6 +548,11 @@ $('#save-add-note-button').on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
if (!Grocy.FrontendHelpers.ValidateForm("add-note-form", true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($(".combobox-menu-visible").length)
|
||||
{
|
||||
return;
|
||||
@@ -591,6 +601,11 @@ $('#save-add-product-button').on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
if (!Grocy.FrontendHelpers.ValidateForm("add-product-form", true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($(".combobox-menu-visible").length)
|
||||
{
|
||||
return;
|
||||
@@ -645,6 +660,11 @@ $('#save-copy-day-button').on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
if (!Grocy.FrontendHelpers.ValidateForm("copy-day-form", true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (document.getElementById("copy-day-form").checkValidity() === false) //There is at least one validation error
|
||||
{
|
||||
return false;
|
||||
@@ -727,9 +747,9 @@ $('#add-product-form input').keydown(function(event)
|
||||
|
||||
$(document).on("keydown", "#servings", function(e)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
if (e.keyCode === 13) //Enter
|
||||
{
|
||||
event.preventDefault();
|
||||
e.preventDefault();
|
||||
|
||||
if (document.getElementById("add-recipe-form").checkValidity() === false) //There is at least one validation error
|
||||
{
|
||||
|
Reference in New Issue
Block a user