Form "Invalid" Event Handler Inconsistent

i I’ve run into this a few times now: I just want to add an invalid event handler to a form, so I can show a notification when the form is invalid. Nothing out of the ordinary. But for some reason, even when the form is valid, the notification still shows up.

After some digging, I traced it back to a module that includes a required field. This field correctly influences the form’s overall invalid state, as expected. However, this doesn’t seem to be reflected in the event handler. In other words, the invalid event is triggered even though the form appears valid. It’s as if the event handler relies on a separate “source of truth” instead of just referencing the form’s actual validity state.

It’s a frustrating issue—not just because it's tricky to debug, but especially because the form's submit flow now breaks. I can’t rely on the submit event to trigger a save query anymore, since it doesn’t fire when the form is (falsely) considered invalid.

My current workaround? I’ve removed the event handlers entirely and call the save query directly from the submit button. It works, but it’s clunky and adds unnecessary complexity. Definitely not ideal.

The form’s invalid event seems to be firing prematurely or based on an outdated state. Your workaround makes sense for now, but hopefully the Retool team can address this inconsistency so we don’t have to build around basic validation logic.

Hi @emozio,

Thanks for reporting this! I haven't been able to reproduce this bug yet :thinking: Is the entire form in the module?

An app export would be great!

Haven't been able to create an app export. The main charasterics are as follows: I have a form with a bunch of fields, a couple of them are modules. They are in fact required, and I was hoping this would get picked up by the validator.

When I assign a "submit" event handler to the form, and one for "invalid", the latter always gets triggered, despite my State indicating the form is in fact not invalid.

That's the gist of it. I hope that will allow you to reproduce the issue in the meantime.