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

v4.10: regression in number fields validation #4328

Closed
2 of 5 tasks
cexbrayat opened this issue Jun 23, 2023 · 2 comments
Closed
2 of 5 tasks

v4.10: regression in number fields validation #4328

cexbrayat opened this issue Jun 23, 2023 · 2 comments
Labels
🐛 bug Unintended behavior

Comments

@cexbrayat
Copy link
Contributor

What happened?

A field of type number that is required is no longer invalid when empty

Reproduction steps

See the demo below.

A form with 2 inputs, one text and one number, with the required rule on both.

The first field displays the error, the second no.
We see this regression across all our applications when bumping to v4.10

<template>
  <div class="row">
    <div class="col-md-6 offset-md-3">
      <h1>Sign up</h1>
      <Form @submit="register($event)">
        <Field name="login" rules="required" v-slot="{ field, meta }">
          <div>
            <label for="login">Login</label>
            <input id="login" v-bind="field" />
          </div>
        </Field>
        <ErrorMessage name="login" />
        <Field name="birthYear" rules="required" v-slot="{ field }">
          <div>
            <label for="birth-year">Birth year</label>
            <input id="birth-year" type="number" v-bind="field" />
          </div>
        </Field>
        <ErrorMessage name="birthYear" />
      </Form>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ErrorMessage, Field, Form, defineRule, configure } from 'vee-validate';
import { required } from '@vee-validate/rules';

defineRule('required', required);
configure({
  validateOnInput: true,
});
</script>

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

No response

Demo link

https://stackblitz.com/edit/github-fcvhex?file=package.json,src%2Fcomponents%2FHelloWorld.vue,src%2FApp.vue

Code of Conduct

@cexbrayat cexbrayat changed the title v4.10: regression in number fields valdiation v4.10: regression in number fields validation Jun 23, 2023
@logaretm logaretm added the 🐛 bug Unintended behavior label Jun 23, 2023
@logaretm
Copy link
Owner

Thanks for reporting this, will release a patch today.

@logaretm
Copy link
Owner

v4.10.1 released with the fix.

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