Skip to content

Redesign of text input component validation #131

Open
@jameswilddev

Description

@jameswilddev

When a text input is invalid, it reports a change of undefined to the parent form.

This generally works, but falls down in a number of scenarios.

For example, distinguishing between "the parent form told us to change to something invalid" (e.g. resetting a form with an invalid field) and "we told the parent form we're invalid, it's just echoing that back to us" is impossible. I thought I had a way in that I could use focus/blur events to discard any changes while the input was focused, but that's not a fix - the events don't reliably happen in any particular order, especially on big forms, so sometimes the latter is confused for the former.

We might be able to fix this by instead using an object for an invalid value. That way we could:

  • Distinguish between invalid values generated by the component and the form.
  • Maybe include some additional metadata about the issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions