diff --git a/InvenTree/static/script/inventree/modals.js b/InvenTree/static/script/inventree/modals.js index 67d4497674..6c6c449fb3 100644 --- a/InvenTree/static/script/inventree/modals.js +++ b/InvenTree/static/script/inventree/modals.js @@ -401,6 +401,10 @@ function handleModalForm(url, options) { else { if (response.html_form) { injectModalForm(modal, response.html_form); + + if (options.after_render) { + options.after_render(modal, response); + } } else { $(modal).modal('hide'); @@ -443,6 +447,7 @@ function launchModalForm(url, options = {}) { * submit_text - Text for the submit button (default = 'Submit') * close_text - Text for the close button (default = 'Close') * no_post - If true, only display form data, hide submit button, and disallow POST + * after_render - Callback function to run after form is rendered */ var modal = options.modal || '#modal-form'; @@ -475,6 +480,10 @@ function launchModalForm(url, options = {}) { if (response.html_form) { injectModalForm(modal, response.html_form); + if (options.after_render) { + options.after_render(modal, response); + } + if (options.no_post) { modalShowSubmitButton(modal, false); } else {