This commit is contained in:
Marc Ole Bulling 2021-01-30 12:47:12 +01:00 committed by GitHub
parent bfb5525ec1
commit c889416c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -244,17 +244,14 @@ if (GetUriParam("embedded") !== undefined)
} }
var eitherRequiredFields = $("#product_id,#product_id_text_input,#note"); var eitherRequiredFields = $("#product_id,#product_id_text_input,#note");
eitherRequiredFields.on("input", function() eitherRequiredFields.prop('required',"");
eitherRequiredFields.on('input', function ()
{ {
eitherRequiredFields.attr("required", ""); eitherRequiredFields.not(this).prop('required', !$(this).val().length);
if (!$(this).val().isEmpty())
{
eitherRequiredFields.not(this).removeAttr("required");
}
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form'); Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
}); });
if (GetUriParam("product-name") != null) if (GetUriParam("product-name") != null)
{ {
Grocy.Components.ProductPicker.GetPicker().trigger('change'); Grocy.Components.ProductPicker.GetPicker().trigger('change');