question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_vm.form.errors.has is not a function

See original GitHub issue

Hi,

I’m trying to set up a edit page, however while receiving the data (to put in the input fields etc), I get this error. It looks like that its an issue with the vForm.

  data() {
    return {
      form: new Form({
        serverid: '',
        name: '',
        ipaddress: '',
        port: '',
        cfapikey: '',
        description: '',
        coverimg: null,
        serverimg: null
      }),
      coverImgUrl: '',
      serverImgUrl: '',
    }
  },
  async fetch() {
    const data = await this.form.get('/server/' + this.$route.params.serverid)
    this.form.keys().forEach((key) => {
      this.form[key] = data.data[key]
    })
    console.log(this.form)
  },

or just

  async asyncData({ $axios, params }) {
    const data = await axios.get('/server/' + params.serverid)
    return {
      form: new Form(data.data),
      serverImgUrl: '',
      coverImgUrl: ''
    }
  },

always prints out _vm.form.errors.has is not a function it works when I wrap my template to a client-only page, but I need to use SSR in NuxtJS.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cretueusebiucommented, Mar 24, 2021

You are returning the form instance from asyncData, but that won’t work with SSR. Here’s how you do it: https://codesandbox.io/s/stoic-minsky-j5pgl?file=/pages/index.vue

0reactions
cretueusebiucommented, Mar 25, 2021

You would just create 2 forms one for create and one for update with only the fields you need for that action. Or do some checks on your back-end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get rid of Error in v-on handler: "TypeError: _vm.myFcn ...
"TypeError: _vm.debouncedOnSubmit is not a function" means vuejs can not find any function in it's build- ...
Read more >
TypeError: _vm.form.errors.has is not a function #5249 - GitHub
Version : 2.2.4 i export to my app: class Error { constructor() { this.errors = {} } has(input) { return this.errors.
Read more >
TypeError (...) is not a function - Get Help - Vue Forum
Hello there, I have a problem with compiling a vue file. ... is not a function" - TypeError: vm.kundeinputstore is not a function....
Read more >
How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >
How to solve “Submit is not a function” error in JavaScript
Solution 1: Simply rename your button's name to btnSubmit or any other name. Your code will miraculously work. This is because you have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found