Vuetify: [Bug Report] form.validate validates hidden and / or disabled fields

Created on 3 Jun 2019  路  2Comments  路  Source: vuetifyjs/vuetify

Versions and Environment

Vuetify: 1.5.7
Vue: 2.6.10
Browsers: Chrome 74.0.3729.169
OS: Windows 7

Steps to reproduce

Enter required Email ID
If the name is hidden (nameShow=false) or disabled (nameShow=true & nameDisable=true)

Expected Behavior

Validations should be skipped for Hidden or disabled fields.
As an extension of the same - form.validate should have a provision to skip validating certain rules (based on specific conditions not necessarily disabled or hidden)

Actual Behavior

form.validate returns false but user cannot enter the value of Name ????

Reproduction Link

https://codepen.io/prasmi/pen/gJqgvM

has workaround wontfix

Most helpful comment

Please reopen.
It's bad idea to validate disabled fields as they don't show any errors.
Inputs might be conditionally disabled and need to be validated in case they are enabled.
Of course I could do something like:
<v-text-field :disabled="condition" :rules="condition ? [] : actualRules">
But this is ugly and unwieldy.

All 2 comments

If the name is hidden

We can't easily know this. Use v-if instead or don't apply rules to inputs when hidden.

disabled

There isn't really a "right" way for this, and it's worked the same way since the beginning. Again, you can choose not to include a field in the validation by simply not binding rules to it.

Please reopen.
It's bad idea to validate disabled fields as they don't show any errors.
Inputs might be conditionally disabled and need to be validated in case they are enabled.
Of course I could do something like:
<v-text-field :disabled="condition" :rules="condition ? [] : actualRules">
But this is ugly and unwieldy.

Was this page helpful?
0 / 5 - 0 ratings