I am currently using the formBuilder. This also works very well so far. In the new Formeo form builder version from developer Kevin Chappell, there is a condition function that I would like to use. Hence the change.
In the current FormBuilder there is an event to query when an element has been opened with the "edit icon":
onOpenFieldEdit
Callback that executes when a field edit window is opened. provides edit panel DOM node
var options = {
onOpenFieldEdit: function (editPanel) {
alert ('a field edit panel was opened');
},
};
$ (container) .formBuilder (options);
I miss this function within the Formeo formBuilder. There is "only" one event there
onRender
Fires when an element is rendered
events: {
onRender: element => {
console.log (`Id rendered" $ {element.id} "`)
},
},
This event is also executed when the page is initially loaded. If there are already 10 elements in the form, there are 10 rendered events.
Unfortunately, I cannot read further information such as field type in Formeo's DOM, so I need to do a little workaround.
const formeoUpdatedThrottled = throttle (
() => {
events.opts.onUpdate ({
timeStamp: window.performance.now (),
type: EVENT_FORMEO_UPDATED,
detail: components.formData,
})
render (components.formData)
},
ANIMATION_SPEED_FAST,
{
leading: false,
}
)
export const render = function renderFields (formData) {
const dataLength = Object.keys(formData.fields).length
let i
if (dataLength> 0) {
i = 0
while (i <dataLength) {
console.log(formData.fields [Object.keys (formData.fields) [i]]. id, formData.fields [Object.keys (formData.fields) [i]]. meta.id);
i ++
}
}
}
Not particularly nice because the render() function is called 2-3 times (No pattern seen so far). Regardless of the number of form elements.
Maybe someone of you knows the "normal" onOpenFieldEdit event?