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

Uncaught TypeError: Cannot read property 'srcElement' of null #863

Closed
dmig opened this issue Sep 29, 2017 · 2 comments
Closed

Uncaught TypeError: Cannot read property 'srcElement' of null #863

dmig opened this issue Sep 29, 2017 · 2 comments
Labels
🐛 bug Unintended behavior

Comments

@dmig
Copy link

dmig commented Sep 29, 2017

Versions:

  • VueJs: 2.3.4
  • Vee-Validate: 2.0.0-rc.18

Description:

 vee-validate.esm.js?c1b4:4218 Uncaught TypeError: Cannot read property 'srcElement' of null
    at fn (vee-validate.esm.js?c1b4:4218)
    at later (vee-validate.esm.js?c1b4:2800)

here are lines 4217-4220:

...
    // if its a DOM event, resolve the value, otherwise use the first parameter as the value.
    if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || args[0].srcElement) {
      args[0] = this$1.value;
    }
...

Steps To Reproduce:

          <q-field :error="errors.has('material')" :error-label="errors.first('material')">
            <q-search autofocus v-model="acTmp" icon="search" name="material" placeholder="Материал" v-validate="'required'" data-vv-scope="material" @blur="reset_value">
              <q-autocomplete :min-characters="3" :max-results="20" @search="search" @selected="selected"/>
            </q-search>
          </q-field>

Here I use q-search + q-autocomplete as select with server-side search. When acTmp field is initialized with null, you get specified error message.

Fix is simple:

    // if its a DOM event, resolve the value, otherwise use the first parameter as the value.
-    if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || args[0].srcElement) {
+    if (args.length === 0 || (isCallable(Event) && args[0] instanceof Event) || args[0] && args[0].srcElement) {
      args[0] = this$1.value;
    }
@logaretm logaretm added the 🐛 bug Unintended behavior label Sep 30, 2017
@dimamarksman
Copy link

dimamarksman commented Oct 6, 2017

In the dist folder we still can see the same issue.

@logaretm
Copy link
Owner

logaretm commented Oct 6, 2017

@dimamarksman This hasn't been released yet, should be released with the next tag.

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

3 participants