Open thegreentimtam opened 2 years ago
Can we get a comment on this? Will there be updated documentation to reflect how to use hooks in 3.x.x?
Hello there,
Amazing library... but I'm a bit stuck now having the same issue over here, any progress in this?
Best,
For anyone looking into validation, I managed to make it work using the following method
$(function() {
const { addFilter } = window.cf.hooks;
addFilter('carbon-fields.text.validate', 'some_namespace', (field, value) => {
console.log(field);
console.log(value);
});
});
The abode function should return a string with the validation error or null if there is no validation errors.
@thegreentimtam no matter what I try, I cannot make this work:
addAction('carbon-fields.init', 'carbon-fields/metaboxes', () => {
console.log('carbon fields metaboxes'); // This works
});
Are you sure your code is working?
EDIT: by adding the code to the footer finally made it work.
I'm trying to do additional validation on my fields using Javascript.
While I have had luck following @jorostoyanov 's comments on Issue #979 using the undocumented
carbon-fields.init
hook, using the same method for the documented hooks is not working.Version
Expected Behavior
Events to trigger when validating select fields and editing fields.
Actual Behavior
Nothing happens.
Steps to Reproduce the Problem