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

Cannot set null value in v-model fields with mask array v-mask="['###.###.###-##', '##.###.### / ####-##']" #67

Closed
eder-ferraz-caciano opened this issue Aug 22, 2022 · 3 comments
Labels
invalid This doesn't seem right

Comments

@eder-ferraz-caciano
Copy link

eder-ferraz-caciano commented Aug 22, 2022

Describe the bug

When using a mask array in the v-mask directive, it is not possible to set a null value in the v-model. This makes it impossible to reset the form data.
Example of using the mask:
<input v-model="CpfCnpj" type="text" v-mask="['###.###.###-##', '##.###.###/####-##']" />
<button @click="CpfCnpj = null"> Clear </button>

To Reproduce
Steps to reproduce the behavior:

  1. Use a mask array in the mask directive as in the example: v-mask="['###.###.###-##', '##.###.###/## ##-##']"
  2. set value in v-model ex:
    <button @click="CpfCnpj = 00133266545"> Set Value </button>
    image
  3. Set a null value in the v-model of the component where the mask array is used.
    <button @click="CpfCnpj = null"> Clear </button>
  4. When setting null value in v-model, it is not applied.

Expected behavior
It must be possible to set a null value in the v-model that has the mask array

Desktop (please complete the following information):

  • OS: Microsoft Windows 11 Pro - v 10.0.22000 - 22000
  • Browser [Chrome]
  • Version [v 104.0.5112.82 - 64 bits]

Additional context
Only the component that uses a mascara array doesn't allow to set null value in v-model. So correctly a form is impossible.

@eder-ferraz-caciano eder-ferraz-caciano changed the title It is not possible to set null value in capos v-model with mask array v-mask="['###.###.###-##', '##.###.###/####-##']" Cannot set null value in v-model fields with mask array v-mask="['###.###.###-##', '##.###.### / ####-##']" Aug 22, 2022
@RonaldJerez
Copy link
Owner

I was unable to reproduce this on both chrome or safari, setting to null worked fine in the demo page.

dynamic-masks

@RonaldJerez RonaldJerez added the invalid This doesn't seem right label Oct 5, 2022
@RonaldJerez RonaldJerez closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2022
@MatthewAry
Copy link

I am having this problem. Here is my attempt to reproduce. https://codepen.io/MatthewAry/pen/MWXOzJV

@simonmaass
Copy link

i am having the same problem with vuetify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

4 participants