diff --git a/changelog/77_UNRELEASED_xxxx-xx-xx.md b/changelog/77_UNRELEASED_xxxx-xx-xx.md index 5152aa25..d63fcec1 100644 --- a/changelog/77_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/77_UNRELEASED_xxxx-xx-xx.md @@ -53,7 +53,7 @@ ### Userfields -- xxx +- Fixed that Userfield default values were not initialized for the `stock` entity (so affecting the purchase and inventory page) ### General diff --git a/public/viewjs/inventory.js b/public/viewjs/inventory.js index 89ca19f8..9d876b0d 100644 --- a/public/viewjs/inventory.js +++ b/public/viewjs/inventory.js @@ -548,3 +548,5 @@ if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER) } }); } + +Grocy.Components.UserfieldsForm.Load(); diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index e53e4159..072d6c33 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -738,3 +738,5 @@ if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER) } }); } + +Grocy.Components.UserfieldsForm.Load(); diff --git a/public/viewjs/userfieldform.js b/public/viewjs/userfieldform.js index 1823500a..1c5ac0fb 100644 --- a/public/viewjs/userfieldform.js +++ b/public/viewjs/userfieldform.js @@ -111,13 +111,18 @@ $("#type").on("change", function(e) $("#default-value-group.userfield-type-" + value).removeClass("d-none"); }); -$('#entity').focus(); - if (GetUriParam("entity")) { $("#entity").val(GetUriParam("entity")); $("#entity").trigger("change"); - $('#name').focus(); + setTimeout(function() + { + $('#name').focus(); + }, 500); +} +else +{ + $('#entity').focus(); } $("#type").trigger("change");