Manually triggering a field validation with form.validateField() not working?
I have a form.FIeld with an onChange validator that depends on a value external to the form. Whenever this external value changes, I want this validator to re-run, so I'm trying to use an effect to manually trigger a validation like so:
There doesn't seem to be any docs explaining how a validator can be manually triggered in response to a non-form value changing, but I saw that this 'validateField' function exists on the form and this seems like it should cause my onChange validator to rerun, but in practice I'm not seeing the onChange callback firing?
For additional context, I'm defining my form like so:
tyia
3 Replies
equal-aqua•4mo ago
That looks like it should work. Could you create a stackblitz reproduction of this not working?
validateField
simply expects a FieldApi to be present, which is the case since you return one in your Component.rare-sapphireOP•4mo ago
Just tried this with form.AppField and it works as expected 🤔
equal-aqua•4mo ago
AppField is just a wrapper for Field, so that shouldn‘t be the deciding factor