I am submitting the dynamic form fields using vue .js with Laravel. I am using Form.js and submitting the form using Ajax. At Run time i set all the new custom fields. But When i submit the form. Then i did not get the values of the dynamic fields. My Code is
data:{
return(){
form: new Form({
title: '',
description: '',
phone_no: '',
price: '',
keywords: '',
country: '',
city: '',
area: '',
building: '',
fileIds: [],
category: this.allData.category,
// body_condition: '',
}),
}
}
My created Method is
created(){
if (this.allData.formFields.length > 0){
// let form = new Form;
for (let i = 0; i < this.allData.formFields.length; i++) {
var str = this.allData.formFields[i].code;
// alert(str);
if(this.allData.formFields[i].type=='multiple-select'){
Vue.set(this.form, str.replace(/-/g, '_'), []);
// this.form.push(str.replace(/-/g, '_'));
}else{
Vue.set(this.form, str.replace(/-/g, '_'), '');
}
}
// console.log(this.$el);
}
},
My dynamic Fields values are missing. Any help will be appreciated. Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire