Hello everyone, how do I use this command in the view?
I need to dinamically change an input value. I found this command in the forum but if I use for example
Please make sure that you use the groceryCrudSetFieldValue only after the add or edit form is opened. Keep in mind that this function is setting live in JavaScript the field. So for example you can do something like this:
window.addEventListener('gcrud.form.edit-load', ({detail}) => {
// use groceryCrudSetFieldValue(‘nameField’, ‘valueField’) here
});
or:
window.addEventListener('gcrud.form.add-load', () => {
// use groceryCrudSetFieldValue(‘nameField’, ‘valueField’) here
});
Also make sure that the “publish_events” configuration is true at your configuration. The default value is false