Prevent form submit when any combobox-dropdown is open (fixes #1236)

This commit is contained in:
Bernd Bestel 2020-12-31 13:45:14 +01:00
parent 1e27f6c127
commit 1459f8c441
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
26 changed files with 150 additions and 0 deletions

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#battery-form').serializeJSON(); var jsonData = $('#battery-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("battery-form"); Grocy.FrontendHelpers.BeginUiBusy("battery-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonForm = $('#batterytracking-form').serializeJSON(); var jsonForm = $('#batterytracking-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("batterytracking-form"); Grocy.FrontendHelpers.BeginUiBusy("batterytracking-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#chore-form').serializeJSON(); var jsonData = $('#chore-form').serializeJSON();
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
{ {

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonForm = $('#choretracking-form').serializeJSON(); var jsonForm = $('#choretracking-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("choretracking-form"); Grocy.FrontendHelpers.BeginUiBusy("choretracking-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonForm = $('#consume-form').serializeJSON(); var jsonForm = $('#consume-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("consume-form"); Grocy.FrontendHelpers.BeginUiBusy("consume-form");
@ -139,6 +144,11 @@ $('#save-mark-as-open-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonForm = $('#consume-form').serializeJSON(); var jsonForm = $('#consume-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("consume-form"); Grocy.FrontendHelpers.BeginUiBusy("consume-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#equipment-form').serializeJSON(); var jsonData = $('#equipment-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("equipment-form"); Grocy.FrontendHelpers.BeginUiBusy("equipment-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonForm = $('#inventory-form').serializeJSON(); var jsonForm = $('#inventory-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("inventory-form"); Grocy.FrontendHelpers.BeginUiBusy("inventory-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#location-form').serializeJSON(); var jsonData = $('#location-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("location-form"); Grocy.FrontendHelpers.BeginUiBusy("location-form");

View File

@ -394,6 +394,11 @@ $('#save-add-recipe-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
if (document.getElementById("add-recipe-form").checkValidity() === false) //There is at least one validation error if (document.getElementById("add-recipe-form").checkValidity() === false) //There is at least one validation error
{ {
return false; return false;
@ -431,6 +436,11 @@ $('#save-add-note-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
if (document.getElementById("add-note-form").checkValidity() === false) //There is at least one validation error if (document.getElementById("add-note-form").checkValidity() === false) //There is at least one validation error
{ {
return false; return false;
@ -472,6 +482,11 @@ $('#save-add-product-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
if (document.getElementById("add-product-form").checkValidity() === false) //There is at least one validation error if (document.getElementById("add-product-form").checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#barcode-form').serializeJSON(); var jsonData = $('#barcode-form').serializeJSON();
jsonData.amount = jsonData.display_amount; jsonData.amount = jsonData.display_amount;
delete jsonData.display_amount; delete jsonData.display_amount;

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#product-group-form').serializeJSON(); var jsonData = $('#product-group-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("product-group-form"); Grocy.FrontendHelpers.BeginUiBusy("product-group-form");

View File

@ -4,6 +4,16 @@ $('#save-purchase-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonForm = $('#purchase-form').serializeJSON(); var jsonForm = $('#purchase-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("purchase-form"); Grocy.FrontendHelpers.BeginUiBusy("purchase-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#quconversion-form').serializeJSON(); var jsonData = $('#quconversion-form').serializeJSON();
jsonData.from_qu_id = $("#from_qu_id").val(); jsonData.from_qu_id = $("#from_qu_id").val();
Grocy.FrontendHelpers.BeginUiBusy("quconversion-form"); Grocy.FrontendHelpers.BeginUiBusy("quconversion-form");

View File

@ -299,6 +299,11 @@ $('#save-recipe-include-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
if (document.getElementById("recipe-include-form").checkValidity() === false) //There is at least one validation error if (document.getElementById("recipe-include-form").checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -4,6 +4,11 @@ $('#save-recipe-pos-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#recipe-pos-form').serializeJSON(); var jsonData = $('#recipe-pos-form').serializeJSON();
jsonData.recipe_id = Grocy.EditObjectParentId; jsonData.recipe_id = Grocy.EditObjectParentId;
delete jsonData.display_amount; delete jsonData.display_amount;

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#shopping-list-form').serializeJSON(); var jsonData = $('#shopping-list-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("shopping-list-form"); Grocy.FrontendHelpers.BeginUiBusy("shopping-list-form");

View File

@ -4,6 +4,11 @@ $('#save-shoppinglist-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#shoppinglist-form').serializeJSON(); var jsonData = $('#shoppinglist-form').serializeJSON();
if (!jsonData.product_id) if (!jsonData.product_id)
{ {

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#shoppinglocation-form').serializeJSON(); var jsonData = $('#shoppinglocation-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("shoppinglocation-form"); Grocy.FrontendHelpers.BeginUiBusy("shoppinglocation-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonForm = $('#stockentry-form').serializeJSON(); var jsonForm = $('#stockentry-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("stockentry-form"); Grocy.FrontendHelpers.BeginUiBusy("stockentry-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#task-category-form').serializeJSON(); var jsonData = $('#task-category-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("task-category-form"); Grocy.FrontendHelpers.BeginUiBusy("task-category-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#task-form').serializeJSON(); var jsonData = $('#task-form').serializeJSON();
jsonData.assigned_to_user_id = jsonData.user_id; jsonData.assigned_to_user_id = jsonData.user_id;
delete jsonData.user_id; delete jsonData.user_id;

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonForm = $('#transfer-form').serializeJSON(); var jsonForm = $('#transfer-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("transfer-form"); Grocy.FrontendHelpers.BeginUiBusy("transfer-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#userentity-form').serializeJSON(); var jsonData = $('#userentity-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("userentity-form"); Grocy.FrontendHelpers.BeginUiBusy("userentity-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#userfield-form').serializeJSON(); var jsonData = $('#userfield-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("userfield-form"); Grocy.FrontendHelpers.BeginUiBusy("userfield-form");

View File

@ -28,6 +28,11 @@ $('#save-user-button').on('click', function(e)
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = $('#user-form').serializeJSON(); var jsonData = $('#user-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("user-form"); Grocy.FrontendHelpers.BeginUiBusy("user-form");

View File

@ -2,6 +2,11 @@
{ {
e.preventDefault(); e.preventDefault();
if ($(".combobox-menu-visible").length)
{
return;
}
var jsonData = {}; var jsonData = {};
jsonData.userentity_id = Grocy.EditObjectParentId; jsonData.userentity_id = Grocy.EditObjectParentId;