Disable HTML5 validation when Save as Draft button is clicked

Created on 7 February 2025, about 2 months ago

Problem/Motivation

Currently, the module successfully disables server-side validation, so the form can be submitted without throwing errors from standard form validation. However, standard HTML5 validation on the client-side still kicks in by default, and so especially if there are dynamically-required form elements (say, from Conditional Fields), the user ends up blocked on that basis, and can't Save as Draft.

Steps to reproduce

Configure Workflow Save as Draft and Conditional Fields on a node with a Workflow attached, and set one field on your node type to be dependent on the value of another, and make it required when the correct value is selected.

Select the appropriate value, and observe that your field is set as required in the DOM. Try to submit the form using the Save as Draft button, and see the HTML5 validation trigger, preventing submission.

Proposed resolution

Add some simple Javascript behaviour to the Save as Draft button to disable HTML5 validation for that submission. This is a simple matter of adding `novalidate=true` to the form, and then allowing submission to continue.

Remaining tasks

I've already got a working patch for this, will commit shortly.

User interface changes

The HTML5 validation warnings will no longer pop up in this scenario.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada spiderman Halifax, NS

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024