Fix rescan bug and implement getDirtyFields#131
Open
AlejandroFrias wants to merge 4 commits intocodedance:masterfrom
Open
Fix rescan bug and implement getDirtyFields#131AlejandroFrias wants to merge 4 commits intocodedance:masterfrom
AlejandroFrias wants to merge 4 commits intocodedance:masterfrom
Conversation
|
I know this is an old item, but I have confirmed that this implementation works perfectly, and should be merged if possible. I also modified it a bit to add support for a input dirty field class, so I can easily style fields that are dirty and identify which fields are causing the form to be dirty right with jQuery. Thanks @AlejandroFrias |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@codedance
Changes
Rescan Bug
Rescan shouldn't be recalculating the original value when the original value is actually an empty string.
My use case that came across this (IMO) bug:
Dynamic form. Add a new blank field to be filled out. Run rescan, which correctly sets the original value of the field to empty string. Then fill in the field, yay it's dirty. Then I add another field. This time rescan incorrectly changes that first field's original value to what I've typed so. Oh no, form suddenly not dirty anymore.
Exposing
getDirtyFieldsAlso needed some functionality to keep my code cleaner. looks like this was asked for in issue #74. So here's my take on that, too.
You can now get the dirty fields:
Just adds a data value
dirtyFIeldsin which the array of dirty fields is added.