From 2de879d2ba579100a1f360cf3459632cefa0191a Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 15 Mar 2021 20:30:18 +1100 Subject: [PATCH] Add option to hide form error message --- InvenTree/part/templates/part/part_base.html | 1 + InvenTree/templates/js/modals.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 1072d7652b..ebcbdef03a 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -241,6 +241,7 @@ "{% url 'part-pricing' part.id %}", { submit_text: 'Calculate', + hideErrorMessage: true, } ); }); diff --git a/InvenTree/templates/js/modals.js b/InvenTree/templates/js/modals.js index 33be851d83..12639749f6 100644 --- a/InvenTree/templates/js/modals.js +++ b/InvenTree/templates/js/modals.js @@ -739,9 +739,10 @@ function handleModalForm(url, options) { // Form was returned, invalid! else { - var warningDiv = $(modal).find('#form-validation-warning'); - - warningDiv.css('display', 'block'); + if (!options.hideErrorMessage) { + var warningDiv = $(modal).find('#form-validation-warning'); + warningDiv.css('display', 'block'); + } if (response.html_form) { injectModalForm(modal, response.html_form);