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 the input programmatically #62

Open
ctessier opened this issue Jul 23, 2017 · 5 comments
Open

How to clear the input programmatically #62

ctessier opened this issue Jul 23, 2017 · 5 comments

Comments

@ctessier
Copy link

Hi,

First, thank you for that awesome component! Works like a charm!

I am looking for a simple way to clear the input programmatically without the use of the data-clear button?

I use the <datepicker> component in the template of another component. I would like to be able to clear the input of the datepicker within a @submit event from the parent form.

Thank you for your help.
Regards,
Clément

@havgry
Copy link
Contributor

havgry commented Aug 5, 2017

Assuming you're using the v-model binding you can simply set the value of your data property to null. That should clear the input field.

@ctessier
Copy link
Author

ctessier commented Aug 9, 2017

I indeed use the v-model binding and set the value to empty as you can see here: MenergyForm.vue. Although this doesn't work. I tried setting it to null but same.

Thank you for your help.

@havgry
Copy link
Contributor

havgry commented Aug 9, 2017

Hmm, so while the underlying value is changed the actual input isn't cleared. I've submitted a pull request here: #69

Btw I don't believe your @input="setDate" binding is necessary.

@ctessier
Copy link
Author

Thank you. Waiting for the #55 to be merged. I also think your approach is better but we will see :)

kagagnon pushed a commit to kagagnon/datepicker that referenced this issue Apr 4, 2018
@cryarchy
Copy link

cryarchy commented Sep 9, 2018

I also have the same issue. Setting the bound to variable's value to "" or null does not clear the input.

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

3 participants