Amend InputRequired
validator to support multi-input fields
#716
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Small change to the
InputRequired
validator, so that it examines the entire contents offield.raw_data
for validation logic (rather than just the first element). This is helpful when the HTML representation of aField
renders more than one<input>
- e.g. using a widget.For example, a WTForms implementation of the Gov.UK Design System Date Input component renders three HTML
<input>
elements. Prior to this fix, missing input in the first (i.e. Day, orraw_data[0]
) input triggers aValidationError
, even if data was entered in the second (i.e. Month, orraw_data[1]
) and/or third (i.e. Year, orraw_data[2]
) inputs.Commit checklist:
pytest
versionadded
orversionchanged
directives to relevant docstrings - see 7a87422