Skip to content

fix(validation): a disabled field should always be valid #21222

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

Merged
merged 2 commits into from
Apr 10, 2025

Conversation

johnleider
Copy link
Member

@johnleider johnleider commented Apr 6, 2025

Motivation and Context

Skip validation if disabled.

TODO: Should this occur on readonly as well? Yes

Markup:

<template>
  <v-container class="pa-md-12">
    <v-form v-model="valid">
      <v-text-field :rules="[val => !!val || 'Required']" label="Regular" />
      <v-text-field :rules="[val => !!val || 'Required']" label="Disabled" disabled />
    </v-form>

    <pre>{{ JSON.stringify(valid, null, 2) }}</pre>
  </v-container>
</template>

<script setup>
  import { ref } from 'vue'

  const valid = ref(false)
</script>

@johnleider johnleider requested a review from a team April 6, 2025 17:28
@johnleider johnleider self-assigned this Apr 6, 2025
@johnleider johnleider added this to the v3.8.x milestone Apr 10, 2025
@johnleider johnleider merged commit 8711494 into master Apr 10, 2025
13 checks passed
@johnleider johnleider deleted the fix/dont-validate-disabled branch April 10, 2025 15:50
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

Successfully merging this pull request may close these issues.

2 participants