You can pass an options object to the builder component and set ignore: true on the fields you don't want. Here is an example:
You can pass an options object to the builder component and set ignore: true on the fields you don't want. Here is an example:
http://formio.github.io/formio.js/app/examples/custombuilder.html
Originally posted by @randallknutson in https://github.com/formio/formio.js/issues/1200#issuecomment-485831686
Hi I cannot find the options object, please help us to fix that. could you provide one example for an option.
@ranjanitechleaf
Hi you can pass options object like this.
Formio.builder(document.getElementById('builder'), { components: formioComponents }, FormBuilder.customForm).then(function (builder) {});
FormBuilder.customForm is an options object which will consist the builder and editForm attributes. EditForm attribute will handle the configuration of that field Modal, ignore: true will hide the field from Modal.
customForm = {
builder: {
...
},
editForm: {
textfield: [
{
key: 'display',
ignore: false,
components: [
{
key: 'prefix',
ignore: true
},
{
key: 'suffix',
ignore: false
}
]
}
]
}
}
Thanks,
Thank you soo much , its working fine
hi. i want to ignore any component in custom tab of base component. but how?

i want to ignore (lable and placeholder ) of (text field) component of ( basic Components) only. thank.
@contona68 you want to ignore label and placeholder or all other fields but not label and placeholder? (I believe you need a label field)
customForm = {
builder: {
...
},
editForm: {
textfield: [
{
key: 'display', // the tab
ignore: false,
components: [ // the fields you want to ignore
{
key: 'placeholder',
ignore: true
},
]
}
],
select:[
{
key: 'data', // the data tab
ignore: false,
components: [ // the fields you want to ignore
{
key: 'dataSrc',
ignore: true
},
]
}
}
}
for all field keys/tabs, look at the source code: https://github.com/formio/formio.js/tree/master/src/components
Thanks for your answer
but i want to custom display tab in textFiels component in Basic component of builder only
not all textField in another .

@contona68 could you post a jsfiddle/codepen of your case with your configuration? (Feel free to for from this: https://codepen.io/localhorst/pen/KKwQoNM)
With editForm.textfield set, you only affect the textfield component.
What does (3) mean in your illustration? you want to remove that only in the textField component?

<script>
var custom = {
title: 'User Fields',
weight: 10,
components: {
firstName: {
title: 'First Name',
key: 'firstName',
icon: 'terminal',
schema: {
label: 'First Name',
type: 'textfield',
key: 'firstName',
input: true,
}
},
lastName: {
title: 'Last Name',
key: 'lastName',
icon: 'terminal',
schema: {
label: 'Last Name',
type: 'textfield',
key: 'lastName',
input: true
}
},
email: {
title: 'Email',
key: 'email',
icon: 'at',
schema: {
label: 'Email',
type: 'email',
key: 'email',
input: true
}
},
phoneNumber: {
title: 'Mobile Phone',
key: 'mobilePhone',
icon: 'phone-square',
schema: {
label: 'Mobile Phone',
type: 'phoneNumber',
key: 'mobilePhone',
input: true
}
}
}
};
window.onload = function() {
Formio.builder(document.getElementById('builder'), {}, {
builder: {
basic: false,
advanced: false,
data: false,
layout: {
components: {
table: false
}
},
premium: false,
customBasic: {
title: 'Basic Components',
default: true,
weight: 0,
components: {
videoEditor: true,
checkmatrix: true,
textfield: true,
textarea: true,
email: true,
phoneNumber: true
}
},
custom: custom
},
editForm: {
textfield: [
{
key: "api",
ignore: true,
},
{
key: "display",
ignore: false,
components: [
{
key: "label",
ignore: true
},
{
key: "tooltip",
ignore: true
},
{
key: "widget",
ignore: true
}
]
}
]
}
}).then(function(builder) {
builder.on('change', function(schema) {
console.log(schema)
});
builder.on('saveComponent', function() {
console.log(builder.schema);
});
});
};
</script>
i create custom cumponet and used textFeild component in it . if i ignore textfield all component that used textfield type be ignore. but I want to ignore textfield in my cutomed in display tab only not all.
@contona68 you mean that custom components like firstName, lastName that are based on textfield components are affected by editForm.textfield definitions as well?
yes I want to ignore and customation display tab in firstName, lastName only. but by this config
editForm: {
textfield: [
{
key: "api",
ignore: true,
},
{
key: "display",
ignore: false,
components: [
{
key: "label",
ignore: true
},
{
key: "tooltip",
ignore: true
},
{
key: "widget",
ignore: true
}
]
}
]
}
all component with type of textfield is affected by editForm.textfield.
You are right, custom fields based on another field seem to inherit the properties. https://codepen.io/localhorst/pen/qBExMqz
I'm not sure if this is a bug, though...
Anyway Thank you.
Hi there! It's been a while, but do you guys have found a way to solve this ? I'm facing the same issue. I'm unable find any way to counter this inheriting behaviour.
Also, it doesn't seem that editForm has any effect on custom fields (based on another field) when referring the the lastName component/key for example.
I would really like to find a solution to that, but no docs and no examples found about this so far. I'm not really sure how to deal with it, any hint would be welcome!
Closing as this is stale, please feel free to reopen and thank you for everyone's contributions to this discussion.