OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

formio override selectboxes component template

  • Thread starter Thread starter Shashank Bhatt
  • Start date Start date
S

Shashank Bhatt

Guest
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

Code:
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.

Code:
{
  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 luck at all.

Code:
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?

Formio library version that I am using is 4.13.0-rc.22.
Continue reading...
 

Latest posts

Top