From fd917b2e41e8039c30cace1bec15312cc9ffbdf5 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 7 Aug 2021 23:30:53 +1000 Subject: [PATCH] Simple refactoring --- InvenTree/templates/js/translated/forms.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index 8e2d3a4c66..9ca0ddccec 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -1016,9 +1016,10 @@ function addSecondaryModal(field, fields, options) { // Extract form values at time of button press var data = extractFormData(fields, options) - // Allow the secondary form to be "prefilled" with a custom function - if (secondary.prefill) { - secondary.fields = secondary.prefill(data); + // If the "fields" attribute is a function, call it with data + if (secondary.fields instanceof Function) { + console.log("Fields is a function!"); + secondary.fields = secondary.fields(data); } // If no onSuccess function is defined, provide a default one