Skip to content

[Proposition] isDirty or isChanged property #105

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

Open
DorijanH opened this issue Dec 1, 2023 · 2 comments
Open

[Proposition] isDirty or isChanged property #105

DorijanH opened this issue Dec 1, 2023 · 2 comments

Comments

@DorijanH
Copy link
Member

DorijanH commented Dec 1, 2023

Issue

A common issue, or a feature if you would, on many different forms is to keep track of the field values and only enable Save or some other CTA button if the values have changed since the form initialization.

Proposed

Consider returning an additional isDirty or isChanged property that would indicate if the value changed from its initial (default) value.

Also consider giving an option to the user to override this default value after validation initialization because most of the time we create inputs using empty strings and then once we fetch data, trigger the change manually.

@DorijanH DorijanH changed the title [Poposition] isDirty or isChanged property [Proposition] isDirty or isChanged property Dec 1, 2023
@AleksandarDev
Copy link
Member

AleksandarDev commented Dec 6, 2023

@DorijanH

Also consider giving an option to the user to override this default value after validation initialization because most of the time we create inputs using empty strings and then once we fetch data, trigger the change manually.

Calling field.setValue(value) on validationField or setValues(formData, values) that are made just for that purpose will leave IsDirty flag unchecked (if we end up exposing it).

@DorijanH
Copy link
Member Author

DorijanH commented Dec 6, 2023

@AleksandarDev

Sweet! It seems I overlooked that

@AleksandarDev AleksandarDev self-assigned this Sep 3, 2024
AleksandarDev added a commit that referenced this issue Sep 3, 2024
@AleksandarDev AleksandarDev removed their assignment Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants