Open marcoheine opened 11 months ago
Not out of the box. I suggest you make a custom control plugin that will enhance the options with the required additional fields, you will need to handle saving the inputs into the field and loading the formData
Hi @marcoheine,
While cleaning up some documentation I discovered that onAddOption callback allows you to add additional fields to the option list. The feature isn't well documented so I'm writing tests for it now and will add to the documentation.
Take a look at the example on https://formbuilder.online/docs/formBuilder/options/onAddOption/
onAddOption: (optionTemplate, optionInfo) => {
console.log('here i am');
console.error('here i am');
optionTemplate.label = `Option ${optionInfo.index + 1}`;
optionTemplate.value = `option-${optionInfo.index + 1}`;
optionTemplate.customText = `custom-text-${optionInfo.index + 1}`;
optionTemplate.customBool = false;
return optionTemplate;
},
You'll need to work on CSS styling.
In the options, there are the three attributes "selected", "label" and "value". Is it possible to add custom attributes to the options ("optionTemplate")? I need a custom textarea and a custom checkbox for each option.
Thanks!