7 Matching Annotations
- Mar 2021
-
final-form.org final-form.org
-
The reason Final Form does this is so that pristine will be true if you start with an uninitialized form field (i.e. value === undefined), type into it (pristine is now false), and then empty the form field. In this case, pristine should return to true, but the value that the HTML DOM gives for that input is ''. If Final Form did not treat '' and undefined as the same, any field that was ever typed in would forever be dirty, no matter what the user did.
-
- Oct 2020
-
-
-
Mine requires that dirty and pristine be "calculated properties".
-
This is a philosophical issue, I think. People (and presumably form libraries) have different definitions of what "dirty" means. Yours: "The field has ever been edited" Mine: "The value of the field is different from the initial value"
-
Personally, I rather like the idea of typing into a field, backspacing to undo what you just typed, and having the field (and form) go back to being pristine. Aside from that aesthetic difference, my definition has the practical implication that it lets you know if you need to save the record or not.
-
We could potentially have another flag that was your definition of dirty, but then we run into the hard problem in computer science: naming things.
-
-
github.com github.com