Skip to content
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

isDirty for a single field #17

Closed
fson opened this issue Sep 19, 2016 · 4 comments
Closed

isDirty for a single field #17

fson opened this issue Sep 19, 2016 · 4 comments
Assignees
Milestone

Comments

@fson
Copy link

fson commented Sep 19, 2016

I wanted to make a form that validates each field only after it's been edited (onChage or onBlur has fired), or alternatively validates all the fields after the user has tried to submit the form.

Can this be done using the Form component? The isDirty field is currently only available for the whole form, not single fields.

@hnordt
Copy link
Owner

hnordt commented Sep 19, 2016

I'm on a vacation now, but I'll try to implement this option today.

Just to confirm, isDirty(fieldName) is what you need?

Em 19 de set de 2016, às 11:10, Ville Immonen notifications@github.com escreveu:

I wanted to make a form that validates each field only after it's been edited (onChage or onBlur has fired), or alternatively validates all the fields after the user has tried to submit the form.

Can this be done using the Form component? The isDirty field is currently only available for the whole form, not single fields.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@fson
Copy link
Author

fson commented Sep 19, 2016

I think so, but I'm not sure, if the dirty check based on value works for my use case: I would also want to track if the user edited the value. After writing something to the input and then clearing it again, the input should still be "dirty", even though it would match the initial value.

@hnordt
Copy link
Owner

hnordt commented Sep 19, 2016

I'll implement additional state to keep track of touched values, your use case is more common than my first implementation just comparing values.

@hnordt
Copy link
Owner

hnordt commented Sep 20, 2016

@fson I have implemented the suggested feature. I hope it helps.

@hnordt hnordt self-assigned this Sep 20, 2016
@hnordt hnordt added this to the v1.0.0 milestone Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants