Ability to add more data to the form dynamically
See original GitHub issueI was wondering if it’s possible to add more data to the form after it’s been instantiated?
For example (psuedo code):
<template>
<select v-model="form.approvers" multiple id="approvers" name="approvers"></select>
</template>
<script>
export default {
data() {
return {
form: new Form({
approvers: [],
})
}
}
mounted() {
$('#approvers').select2({
placeholder: "Enter approvers ",
});
},
methods: {
save() {
// Ex.
this.form.setData(key, value);
this.form.post();
}
}
}
</script>
I have a multi-select form input that is constructed using Select2, but using v-model="form.approvers"
on the select doesn’t seem to post the selected values from select2.
Do you know of any ways around this or why it might not be grabbing the values from the select input?
Thanks! 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Dynamically creating a specific number of input form elements
Create new elements by means of document.createElement() , and use appendChild() to append each of them to the container. You might be interested...
Read more >Able to add more fields dynamically within the form - Jotform
Hello, we're launching a campaign to update our database with the correct safety contacts within our member companies.
Read more >Power Apps Dynamic Form Schema | Add Controls on the fly
In this video, you will learn how to build Dynamic Forms in Power Apps. We will create the controls of the Form dynamically...
Read more >How to Create a Form Dynamically with the JavaScript?
Approach 1: Use document.createElement() to create the new elements and use setAttribute() method to set the attributes of elements. Append ...
Read more >Dynamically add fields from a table into a form
If you want to add fields from your data source into a Edit form dynamically, I afraid that there is no way to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can:
But for your case you should make a custom component then have something like:
https://vuejs.org/v2/examples/select2.html
Or try this one https://github.com/monterail/vue-multiselect
@joneyspark try this as mentioned above. https://github.com/shentao/vue-multiselect