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

Proper clearing form field values #29

Open
tomwagner opened this issue Nov 7, 2017 · 0 comments
Open

Proper clearing form field values #29

tomwagner opened this issue Nov 7, 2017 · 0 comments

Comments

@tomwagner
Copy link
Contributor

I think that proper way to clean forms values could be set them to undefined value:

value: '',

Now it's clearing to empty string, but this value can be also a user input. And in functionality of setting defaultValue to Input doesn't work correctly. There is one condition which set input fields to defaultValue only if they are undefined:

// Enable to set default value only if value is undefined
if (typeof fieldProps.value !== 'undefined') {
return;
}

So for example if i have one form where some input (eg. select) has defaultValue and i clear this form by action clearForm it clears all values in state with empty string, but default value of this select won't be set because of condition above.

tomwagner added a commit that referenced this issue Nov 7, 2017
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

1 participant