Skip to content

Form valid event issued when elements are invalid. #92

@GeoffCapper

Description

@GeoffCapper

I'm trying to use Hyperform to detect when the form switches between an invalid and valid state so I can switch disabling of the submit button.

If I monitor the "valid" event on the form it keeps getting triggered even though elements within the form are still invalid.

If I run form.checkValidity() on startup each field will indicate an "invalid" event and checkValidity returns false. It seems calling "checkValidity" on the form won't trigger any event on the form (validate, invalid or valid).

I've got a test with three required text fields and a submit button. If I tab through the fields they each report "invalid" events, but nothing at the form level. Once I reach the submit button the form reports a "valid" event (when it should really be "invalid").

Test, if it helps, is at: https://codepen.io/GeoffCapper/pen/eYNQWYr

When I click submit the form issues a "validate" event, and each field in turn issues an "invalid" event followed by the form issuing an "invalid" event. Once all the fields have been checked the form then issues a "valid" event.

Are the form-level "valid"/"invalid" events broken, or are they for some other purpose than I'm thinking?

Thanks,
Geoff

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationNot a bug, but behaviour needs better documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions