diff --git a/client/src/components/Form/FormDisplay.vue b/client/src/components/Form/FormDisplay.vue index 9d7f86e684d..db41b879e76 100644 --- a/client/src/components/Form/FormDisplay.vue +++ b/client/src/components/Form/FormDisplay.vue @@ -79,6 +79,10 @@ export default { type: Boolean, default: false, }, + allowEmptyValueOnRequiredInput: { + type: Boolean, + default: false, + }, }, data() { return { @@ -89,7 +93,7 @@ export default { }, computed: { validation() { - return validateInputs(this.formIndex, this.formData); + return validateInputs(this.formIndex, this.formData, this.allowEmptyValueOnRequiredInput); }, }, watch: { diff --git a/client/src/components/Form/utilities.js b/client/src/components/Form/utilities.js index aff9fa2ba0b..58b18d79d91 100644 --- a/client/src/components/Form/utilities.js +++ b/client/src/components/Form/utilities.js @@ -104,7 +104,7 @@ export function matchInputs(index, response) { * @param{dict} index - Index of input elements * @param{dict} values - Dictionary of parameter values */ -export function validateInputs(index, values) { +export function validateInputs(index, values, allowEmptyValueOnRequiredInput = false) { let batchN = -1; let batchSrc = null; for (const inputId in values) { @@ -113,8 +113,10 @@ export function validateInputs(index, values) { if (!inputDef || inputDef.step_linked) { continue; } - if (inputValue == null && !inputDef.optional && inputDef.type != "hidden") { - return [inputId, "Please provide a value for this option."]; + if (!inputDef.optional && inputDef.type != "hidden") { + if (inputValue == null || (allowEmptyValueOnRequiredInput && inputValue === "")) { + return [inputId, "Please provide a value for this option."]; + } } if (inputDef.wp_linked && inputDef.text_value == inputValue) { return [inputId, "Please provide a value for this workflow parameter."]; diff --git a/client/src/components/Workflow/Run/WorkflowRunFormSimple.vue b/client/src/components/Workflow/Run/WorkflowRunFormSimple.vue index c73b8b58ff7..b0a166144c4 100644 --- a/client/src/components/Workflow/Run/WorkflowRunFormSimple.vue +++ b/client/src/components/Workflow/Run/WorkflowRunFormSimple.vue @@ -43,7 +43,11 @@ - + Expand to full workflow form. @@ -137,6 +141,8 @@ export default { onValidation(validation) { if (validation) { Vue.set(this.stepValidations, validation[0], validation[1]); + } else { + this.stepValidations = {}; } }, reuseAllowed(user) {