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

meta.valid should be checked again after reset #3463

Closed
gaby64 opened this issue Aug 27, 2021 · 8 comments
Closed

meta.valid should be checked again after reset #3463

gaby64 opened this issue Aug 27, 2021 · 8 comments
Labels
🐛 bug Unintended behavior

Comments

@gaby64
Copy link

gaby64 commented Aug 27, 2021

I want to keep my submit button disabled until all required fields have values and they are valid.

At the moment there is no way to do this, I cant even loop through the form fields to check that required fields have been touched and are valid.

template ref is borked without state and more internals available

@logaretm logaretm added the 🤔 needs reproduction This issue requires a demo label Aug 27, 2021
@logaretm
Copy link
Owner

Please use the issue creator form and fill all the details, I don't have enough details to go on here.

A demo on codesandbox will help a lot.

@gaby64
Copy link
Author

gaby64 commented Aug 30, 2021

I want to keep my submit button disabled until all required fields are filled.

Im not sure how to do this, so I cannot provide a demo.

I am using the Form and Field Components.

Either there should be a new meta property to signal when all mandatory fields have values,
or fields array should be exposed so I can do the check myself
fields.some(field => field.rules.includes('required') && !field.value?.length)

@logaretm
Copy link
Owner

Well, I cannot just guess what's going on because I already have tests for that case. So a demo would help me a lot to investigate your case, it can be a simple issue or an edge case.

You can use codesandbox to replicate the issue, and you can use any of the examples on the docs and fork if that's going to help.

@gaby64
Copy link
Author

gaby64 commented Aug 31, 2021

I got the demo to reproduce the issue

Edit vee-validate v4 with Quasar framework (forked)

I call formReset() when the form is open, this seems to be where the issue begins.
I need to be able to call this because my form is for both submitting new and editing old, so if I click to edit, the form is filled with that document data, if I chose to add instead, by pressing a create button, the form is cleared.

@logaretm
Copy link
Owner

I don't see any rules on the second field, so its always valid.

<!--                               👇 -->
<Field as="div" name="notes" rules="" v-slot="{ field }">

@gaby64
Copy link
Author

gaby64 commented Aug 31, 2021

I simplified the demo, it has the correct behavior until you click resetForm

Edit vee-validate v4 with Quasar framework (forked)

@logaretm
Copy link
Owner

Oh thanks, yea the silent validation doesn't run after the reset function is called.

@logaretm logaretm reopened this Aug 31, 2021
@logaretm logaretm added 🐛 bug Unintended behavior and removed 🤔 needs reproduction This issue requires a demo labels Aug 31, 2021
@logaretm logaretm changed the title form meta.valid should be false if required fields are empty meta.valid should be checked again after reset Aug 31, 2021
@logaretm
Copy link
Owner

Should be fixed in 4.4.10, thank you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants