You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
The result of createFormReducer has properties like touched, valid, pristine etc.
Some of these properties need to change based on Fields within that Form. For instance, if I touch the email field below, then newUserForm.touched should be true, yet it stays false.
I want the submit button to be enabled under the condition that the form is touched and the fields are valid. So it would be disabled if the form isn't touched or one or more of the fields are invalid.
So, if I changed the submit button disabled attribute to:
{ !newUserForm.valid || !newUserForm.touched }
The disabled property would be wrong because .touched and .untouched don't update. They need to change if any one field within the form changed.
Semantically the reason is this: "If I touch a field within the form, I have touched the form."
The text was updated successfully, but these errors were encountered:
This takes care of setting the form to TOUCHED. BUT it does not take care of the SET_TOUCHED ability. Imagine this:
a user touched a field and then the code calls SET_UNTOUCHED. The form was touched so we need to check if other children were touched, if so the form stays touched but if nothing else was touched, then the form becomes untouched. PRISTINE implements this logic, but touched doesn't.
The result of createFormReducer has properties like touched, valid, pristine etc.
Some of these properties need to change based on Fields within that Form. For instance, if I touch the email field below, then newUserForm.touched should be true, yet it stays false.
I want the submit button to be enabled under the condition that the form is touched and the fields are valid. So it would be disabled if the form isn't touched or one or more of the fields are invalid.
So, if I changed the submit button disabled attribute to:
The disabled property would be wrong because
.touched
and.untouched
don't update. They need to change if any one field within the form changed.Semantically the reason is this: "If I touch a field within the form, I have touched the form."
The text was updated successfully, but these errors were encountered: