Closed Nodios closed 3 years ago
please can you make a codesandbox with this issue?
@foxhound87 here: https://codesandbox.io/s/objective-colden-zn25m
I can see that the hooks are called correctly
No, look at the question.
If you click on form reset, should field onReset hook be called?
No, it should not be called, but I don’t see strange behavior
You said it should be called, but it is not. This is a bug then.
Sorry, I misunderstood the question.
The fields
has their own onReset handler which calls the onReset hook on the field.
Actually you have to call field.reset() (or field.onReset) on the form onReset handler for each filed you need.
I got that correct. This what is depicted in the example. Okay, that pretty much solves it for me. It is by design :)
you can easly achieve it:
hooks: {
onReset: (form) => {
console.log("Form 'onReset' called");
form.each((field) => field.onReset(new CustomEvent('onReset')));
}
}
Yes, I am aware of that. Thank you
If you register onReset event handler on a field and then trigger form.onReset, field value is reset to but the field event handler is not called.
Is this by design?