Amend `InputRequired` validator to support multi-input fields
Small change to the InputRequired validator, so that it examines the entire contents of field.raw_data for validation logic (rather than just the first element). This is helpful when the HTML representation of a Field 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, or raw_data[0]) input triggers a ValidationError, even if data was entered in the second (i.e. Month, or raw_data[1]) and/or third (i.e. Year, or raw_data[2]) inputs.
Commit checklist:
- [x] add tests that fail without the patch - see 9797106d
- [x] ensure all tests pass with
pytest - N/A add documentation to the relevant docstrings or pages
- [x] add
versionaddedorversionchangeddirectives to relevant docstrings - see 7a87422 - [x] add a changelog entry if this patch changes code - see 7a87422
Hi. Thank you for your patch. I am very interested in the subject of wtforms being able to manage several input. This may be related to #662. I think I have to take some time to think of all the implications, so that would be when I am a little less busy. But I do not forget.