janiskelemen / formvuelar

Vue form components with server-side validation in mind
https://janiskelemen.github.io/formvuelar/
MIT License
301 stars 25 forks source link

Errors #4

Closed nikoz84 closed 5 years ago

nikoz84 commented 5 years ago

Hi. first that all thanks for the plugin.

i'm have a problem with this function hasErrors:

TypeError: **_vm.$parent.hasErrors** is not a function at Proxy.FvlSearchSelectvue_type_template_id_18b3ecd3_render (app.js:32391) at VueComponent.Vue._render (app.js:146950) at VueComponent.updateComponent (app.js:147466) at Watcher.get (app.js:147877) at new Watcher (app.js:147866) at mountComponent (app.js:147473) at VueComponent../node_modules/vue/dist/vue.common.dev.js.Vue.$mount (app.js:152443) at VueComponent../node_modules/vue/dist/vue.common.dev.js.Vue.$mount (app.js:155328) at init (app.js:146530) at createComponent (app.js:149372)

just import a component FvlSearchSelect

import { FvlSearchSelect } from "formvuelar";

<FvlSearchSelect :option-key="'id'" :option-value="'title'" :searchKeys="['id', 'title']" :name="'tags'" :options="[{title:'titulo1',id:15},{title:'titulo2',id:1}]"/>

how can i fix this issue?

janiskelemen commented 5 years ago

Hi,

You always have to wrap the the components with the form component:

<fvl-form :data="form" url="/select">
<FvlSearchSelect :option-key="'id'" :option-value="'title'" :searchKeys="['id', 'title']" :name="'tags'" :options="[{title:'titulo1',id:15},{title:'titulo2',id:1}]"/>

</fvl-form>

Look at the example: https://github.com/janiskelemen/formvuelar/blob/master/src/examples/selects/SearchSelect.vue

nikoz84 commented 5 years ago

ok thanks!!

smeranda commented 4 years ago

Hi Janis,

How would you suggest making this work with subcomponents? I'm running into this issue and I don't want an fvl-form component around my child-component (I don't want a form inside a form):

<template>
    <fvl-form>
        <fvl-input />
        <child-component />
    </fvl-form>
</template

ChildComponent.vue:

<template>
    <fvl-input />
</template>