-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] protected initialValue and/or get hasChanged() #105
Comments
@mattleonowicz Yes.
Seems that you are looking for something like |
Yes exactly. I often need to check if the form is I'm aware that simple |
That is part of it. formstate-x recommend composing simpler states to more complex states (with It is also a result of our discussion about user experience. Users can easily recall when they have made a change, but they often struggle to remember the initial value. For instance, if a text input starts with "abc" and the user types to change it to "abcd", it's clear to them why the modal can't close or the save button is enabled—they recognize they have modified something. However, if they continue typing and cycle through "abcde", "abcd", and finally back to "abc", they are likely unaware that the final value is just the same as the original. What they do know is that they have made a change. Therefore, it would be confusing if the modal were allowed to close or the save button were disabled in this situation. Now it may be better to just let them submit the form (or offer some explicit "cancel" / "reset" button), which eliminates uncertainty. |
It's fine if you still prefer "dirty." A PR that changes |
Ok I understand. I mostly agree with your point of view. Thanks! |
@mattleonowicz released in v3.1.3. |
Would you be willing to accept a PR where
initialValue
inFieldState
becomesprotected
instead ofprivate
(to make extending easier) and/or addhasChanged
getter which would return boolean if currentvalue
is different then theinitialValue
?The text was updated successfully, but these errors were encountered: