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

How to clear a field? #7

Open
lgsanjos opened this issue Sep 15, 2015 · 1 comment
Open

How to clear a field? #7

lgsanjos opened this issue Sep 15, 2015 · 1 comment

Comments

@lgsanjos
Copy link

After submitting a form I'd like to clear the data.

Usually this should be enough

this.refs.requestForm.getDOMNode().reset();

But didn't work, also I tried

React.findDOMNode(this.refs.phone).value = '';

Both ways work for common inputs, but no luck with inputmask. Any suggestion ?

@Dzeinz
Copy link

Dzeinz commented Jun 13, 2017

Late to comment on this but I found the solution.

If you use ref on a MaskedInput, you need to call:
this.refs.<YOUR REF NAME>.input
to access values or reset.

this.refs.requestForm.input.getDOMNode().reset();
should work for your case

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