Skip to content

reportValidity() method on date inputs #374

@martindholmes

Description

@martindholmes

We currently hard-code this call on our search page date elements:

onchange="reportValidity()"

For one thing, this appears to be doing nothing (at least in Firefox); when garbage data is entered into the field, no error is raised by the browser.

Secondly, hard-coding an inline script call is likely to fall foul of CORS restrictions in future, so we probably should not do validity checking this way.

I think we should:

  1. Remove the call entirely in dev.
  2. Try to find any cases in existing projects where this validity check is actually doing anything useful.
  3. If we can find any such examples, figure out why they're working and others aren't.
  4. Check the regex we're using for dates. It includes start and end anchors, and I don't think they're necessary, so it's possible that they're borking the pattern and causing the browser to ignore it.
  5. If there is a way to get it working as expected, replace the hard-coded onchange event call with an event listener added on load.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrelease-blockerThe dev branch must not be merged into master while a release-blocker bug is open.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions