mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Improved shopping list item form validation (closes #1226)
This commit is contained in:
@@ -167,6 +167,9 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$("#note").trigger("input");
|
||||
$("#product_id").trigger("input");
|
||||
});
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||
@@ -235,4 +238,16 @@ if (GetUriParam("embedded") !== undefined)
|
||||
}
|
||||
}
|
||||
|
||||
var eitherRequiredFields = $("#product_id,#product_id_text_input,#note");
|
||||
eitherRequiredFields.on("input", function()
|
||||
{
|
||||
eitherRequiredFields.attr("required", "");
|
||||
if (!$(this).val().isEmpty())
|
||||
{
|
||||
eitherRequiredFields.not(this).removeAttr("required");
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
|
Reference in New Issue
Block a user