On change if any field is changed

Hi,

I’ve set up some multiple “on change” events using arrays of fields, but I was wondering if there was a option to set an “on change” if any field was changed?

Or would I have to put every field into an array and use the iteration loop to check for changes?

Thanks
Nick

Hi @Nick.Jones,

Try using fd.fields() to get an array of all form fields like this:

fd.rendered(() => {
    fd.fields().forEach(item => {
        item.$on('change', () => {
            somethingHappened(item);
        });
    });
});

function somethingHappened(field) {
    console.log('Something happened to ' + field.title)
}

Let me know how it goes.

1 Like