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

QInput's rules prop has bug #17734

Open
kwarnkham opened this issue Jan 7, 2025 · 0 comments
Open

QInput's rules prop has bug #17734

kwarnkham opened this issue Jan 7, 2025 · 0 comments

Comments

@kwarnkham
Copy link
Contributor

Description

This is how I use rules

:rules="[
              ruleNotEmpty,
              (val) =>
                removeCommaFromNumber(val) <= 10000 ||
                'The amount is higher than the tender amount',
              ruleGreaterThanZero,
            ]"

These are the rules

  const ruleNotEmpty = (val) => val !== '' || 'Cannot be empty';
  const ruleGreaterThanZero = (val) => removeCommaFromNumber(val) > 0 || 'Minimum value is 1'

When I try to trigger the validation errors, sometimes I get the following error.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'focus')
  at quasar_dist_quasar__client__js.js?v=5ff75e9a:15063:79
  at Array.find (<anonymous>)
  at quasar_dist_quasar__client__js.js?v=5ff75e9a:15063:40

When I follow the link in error

if (focus2 === true) {
          const activeError = errors.find(({ comp: comp2 }) => typeof comp2.focus === "function" && vmIsDestroyed(comp2.$) === false);
          if (activeError !== void 0) {
            activeError.comp.focus();
          }
        }

Documentation Section URL

https://quasar.dev/vue-components/input#qinput-api

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Components (quasar)

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

No branches or pull requests

1 participant