I am new to formio and just started using it and i read the documentation on how to customize its native templates with our own highlighted on this link
https://help.form.io/developers/form-development/form-templates#overriding-templates
Templates.current = {
input: {
form: (ctx) => '<div>My custom template</div>'
},
};
and as per the theory, it seems like we need to pass componentname (which is input here) as a key of the json for which overriding is needed and then under the form key within the sub-json, we need to pass function which accepts context (ctx) and returns html with some manipulation using that ctx.
I have used the same thing but with no effect in frontend. So basically, I have some code somewhere where this component json is used.
{
label: 'somelabel',
selectThreshold: 0.3,
calculateValue: "value = a+ b",
validate: {
onlyAvailableItems: false,
},
key: 'productAccessories',
properties: {
triggerprop: 'orderData',
},
type: 'selectboxes',
inputType: "checkbox",
indexeddb: {
filter: {},
},
input: true,
},
So I thought I would need to pass selectboxes
as key instead of input and tried like that. Here I am using Formio.Templates
as i am using it as cdn in global scope, but this did not change anything. and then also tried after changing from selectboxes
to checkbox
with no lunk at all.
Formio.Templates.current = {
selectboxes: {
form: (ctx) => '<div>My custom template</div>'
},
};
// above did not work not sure why
Can anyone please help on this topic as i need this to be fixed asap?