-
Notifications
You must be signed in to change notification settings - Fork 33
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
Dynamic Rows #21
Comments
Hmm, it sounds like you were maybe adding a field without a type. Can you post your source ( or at least the relevant parts ) so that I can take a look at it? |
|
Also then, how is the model updated for the dynamic inputs?
? |
Ah, I see. Well, firstly the error is this line
I haven't tried setting up the dependants as an array so you will have to play around with that to see if you can get it to work. Maybe something like:
Note that I haven't tested that so it may not work.
and then in your
OR you could make your dependants an actual field type. This would require you to add your own field type to Vue Formly but then you could do something like:
and you could handle the adding/removing of dependants in that dependants field. See here for how to create your own fields. |
Thanks you. I was thinking that most of this might be the case, so glad that I'm starting to get it. Just wanted to check to see if you had more of this worked out than what is in the documentation. Could this be added. At least that Dynamic updates are available? Maybe using this or something similar as an example? Thanks again. |
Yup, sure, I'll put it on the list of things to do :) I'll leave this open for now so that I don't forget. |
EDIT: I'm terrible sorry, I miss the vue-formly-bootstrap now everything works normally I'm having the same problem but rather to be advance like blalan, is quite simple still I got the same error. Unknown custom element: <formly_input> - did you register the component correctly? For recursive components, make sure to provide the "name" option. <template id="actions-bar">
<div class="actions-bar">
<button class="btn btn-blue" @click="showAddForm = true"><icon name="plus" class="btn__icon"></icon>{{ $t('add-client') }}</button>
<modal v-if="showAddForm" @close="showAddForm = false">
<h3 slot="header">{{ $t('add-client') }}</h3>
<div slot="body">
<form @submit="handleSubmission">
<formly-form :form="form" :model="model" :fields="fields"></formly-form>
<button>Submit</button>
</form>
</div>
</modal>
</div>
</template>
<script>
import 'vue-awesome/icons/plus'
import Modal from './../Modal'
export default {
components: {
Modal
},
data () {
return {
showAddForm: false,
model: {
salutation: '',
name: [],
idno: '',
address: '',
postcode: '',
land: '',
country: '',
telephone: '',
email: ''
},
form: {},
fields: [
{
key: 'salutation',
type: 'input'
},
{
key: 'name[0]',
type: 'input',
required: true,
templateOptions: {
label: this.$tc('clients.form.name')
}
},
{
key: 'idno',
type: 'input',
required: true
},
{
key: 'address',
type: 'input',
required: true
},
{
key: 'postcode',
type: 'input',
required: true
},
{
key: 'land',
type: 'input',
required: true
},
{
key: 'country',
type: 'input',
required: true
},
{
key: 'telephone',
type: 'input',
required: true
},
{
key: 'email',
type: 'input',
required: true
}
]
}
},
methods: {
handleSubmission () {
return true
}
}
}
</script>
<style lang="scss">
</style> |
no worries, glad it's working :) |
Tried to add a button that pushes changes to fields, got this error:
[Vue warn]: Unknown custom element: <formly_undefined> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
Is adding fields an option? Or am I doing it wrong?
The text was updated successfully, but these errors were encountered: