I'm using
@payloadcms/plugin-form-builder
in a project and wandering if there is a way to add fields within the predefined fields?
As an example, I want to add placeholder to all the available fields like text, message, number, etc. I'm dead sure the screenshot is self explanatory. 😆
Thanks
@jacobsfletch tagging you because you know form-builder inside out. 🙂
@face44 you should be able to do this using field overrides described here:
https://github.com/payloadcms/plugin-form-builder#field-overrides. Basically just add a new field to the
fields.text
property in your plugin config.
Thank you @jacobsfletch.
The following code works but requires a
@ts-ignore
, the ts error is also attached.
formBuilder({
fields: {
payment: false,
state: false,
country: false,
text: {
...fields.text,
fields: [
//@ts-ignore
...fields.text.fields,
{
type: 'text',
name: 'placeholder',
},
],
},
},
formOverrides: {
fields: [{ name: 'webhook', type: 'text' }],
},
}),
Am I doing it right or is my code is obviously crap?
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.