open-forms icon indicating copy to clipboard operation
open-forms copied to clipboard

Add "soft required" validation/hint to document uploads component

Open sergei-maertens opened this issue 7 months ago • 1 comments

Taiga DH 661, business case "ondernemers"

Approval for the "dynamic variant" is given.

Forms require documents to be uploaded that provide information whether the permit can be granted or not. However, any permit request must be taken into consideration because of legal reasons, even if not all (required) documents are provided. To improve the user experiences and avoid unnecessary costs, we want to be able to mark a (document) field as "soft-required" so that if no documents are uploaded, a warning can be displayed to the end users that they may incur additional costs. This will not block progress to the next step / submission completion.

image

The technical implementation will be challenging for this.

Tasks

  • [ ] Add validation option softRequired in the form builder/form designer. This cannot be enabled both at the same time as validate.required is checked (so toggling one should uncheck the other).
  • [ ] Add a new custom component "SoftRrequiredErrors", which is a variant of the Content component. There should be a placeholder in here for the actual errors that will be programmatically filled, something like {{ field_errors }}. This must work properly with the CSP.
  • [ ] Implement the detection of empty values - in a generic way, not just targetting file upload components. This mechanism is likely to get extended in the future to other component types. For "invalid" components, we need to extract the label to display it in the placeholder location, and for accesibility reasons the "invalid" components should have a pointer to the error node linking everything together (TODO Sergei: double check this with notes from NL DS meeting)

sergei-maertens avatar Jul 22 '24 08:07 sergei-maertens