thorus
1
I will get the checkox ids from the DB c1 c 2 c3…
submit () {
userdata.insert({
checkboxname: [ARRAY OF CHECKBOXES],
})
OR
make checkboxlist work with upsert so it also work when people will update there checkboxes list
Codepen example: https://codepen.io/nordthorus/pen/JMajOM?editors=1010
thorus
2
No one have a basic example? need more info?
thorus
3
I did it with:
<v-checkbox v-on:change="checkThis('CHECKBOXNAME', $event)" style="flex-wrap:nowrap;" v-model="checkhealths" label="CHECKBOXNAME" value="CHECKBOXVALUTE" ></v-checkbox>
<v-checkbox v-on:change="checkThis('CHECKBOXNAME2', $event)" style="flex-wrap:nowrap;" v-model="checkpersonals" label="CHECKBOXNAME2" value="CHECKBOXNAME2" ></v-checkbox>
script
methods: {
checkThis(message, value) {
if ( $.inArray(message, value) > -1 ) {
// insert or update
Meteor.call('checkThisInsert',message, function(error, response) {});
}
else {
// remove from the db
Meteor.call('checkThisRemove',message, function(error, response) {});
}
},
}
SERVER main.js
Meteor.methods({
// Update / remove
checkThisInsert: function(message) {
let meteorUser2 = Meteor.userId();
COLLECTIONNAME.upsert(
{userid: meteorUser2},
{$addToSet: { CHECKBOXNAME: message } }
);
},
checkThisRemove: function(messageremove) {
let meteorUser2 = Meteor.userId();
COLLECTIONNAME.update(
{userid: meteorUser2},
{$pull: { CHECKBOXNAME: messageremove } }
);
},
}
If someone have improvements then please comment