Listen to form validation errors

Hello everyone!

I’m having an issue that I can’t figure out how to solve.

We have an application in React using the @okta/okta-signin-widget.
In a signup form, we would like to track the validation errors (frontend wise) on the form to better understand our users:

  • email/username message error
  • password message error
  • accept terms message error
  • etc

I couldn’t find any event related to that or anything that would dispatch an action outside the widget.

The only thing I could think of, and it’s a very ugly solution, is to listen to the submit event on the form every time and check if there is any message error in the dom.

Is there a better way to achieve that using something from the widget api?

PS: I tried to inspect the afterError event but it’s dispatched just when the form is fully ready to be sent, without frontend validation errors, and there are backend errors.

Thank you!!

Hi @italoborges! Unfortnately, we don’t have a better way than the solution you mentioned via listening to the submit event; afterError is only for permanent errors as you found. I encourage you to post your analytics use case on our feature request page - so that others can vote on it too :pray: