department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
99 stars 69 forks source link

Add validation to the Operating Status Details to make it required when non-normal (not launch blocking) #19901

Open omahane opened 12 hours ago

omahane commented 12 hours ago

User Story or Problem Statement

As an editor, I want to ensure that I have filled out the Details section of the Operating status when the status is anything but normal.

Implementation steps

Constraint validation using PHP (VBA)

We have done something like this on VBA facility banners. If the editor chooses Display a banner alert on this facility, then subordinate empty fields will throw a validation error. Image

Javascript validation (Campaign Landing Page)

We have another pattern on Campaign Landing Page which prevents the user from submitting the form if they have enabled a given section, such as Events, but have not filled out the required fields for those sections.

This is done using form states.

Image

Events: Registration info

Has similar validation. Choose Registration method, and exposed fields are required, using custom JS. There is no server-side mechanism for this.

Image

Design principles

For background, the field appears to be required, showing with an asterisk. Image

Acceptance Criteria

We don't necessarily expect markup to change, as fix is likely to be in PHP or JS, so we did not list a11y review as an AC. If markup does change, A11y review becomes required.

jilladams commented 10 hours ago

Per Laura / Michelle discussion: Editors seem to think it's required and only leave it blank for CAPs. Leaving it blank doesn't break FE. The blank field does pipe through to FE.

A good example of handling, per Daniel, may be the Registration Info field on Events.

jilladams commented 10 hours ago

@omahane wlll take a look at the JS solution on Events to determine path forward. That's necessary before we can refine and point.