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
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