Module's form validation ignored in app

I've created a module which consists of a form that should only allows submissions if certain fields required fields are present. As expected, when editing and testing the module in isolation, the submission button is disabled until those fields are filled out. However, when I use the module in an app, the submission button remains active and usable even though the fields required by the validation are still empty.

I'm using a form and using the Disable Submit option with Custom Rules: something like {{ newNameInput.invalid || !tsformIsValid.value }} where newNameInput is a form field and tsformIsValid is a transformer defined in the same module that returns error strings based on the form fields.

When I inspect the module state in the app, the transformer validation does indicate that the validation rules are not met.

I've published updated versions of the module to make sure the app has the most recent changes.
Based on this post I've tried renaming my form validation transformer to avoid namespace collision with a different transformer in the app, but no dice.

I'm scratching my head at why the validation defined in the module is ignored in the app. Any ideas?

1 Like

Hi @claire_snofox,

If you're using the form component, you can check form1.invalid. If all required fields are filled, it will return true; otherwise, it will return false.

3 Likes

Yep, I'm doing so in the form module. Here's a screenshot of the form settings in the module editing view:

The form submission validation logic works in the module sandbox but as soon as I import the module into my app, that's all encapsulated into the module:

1 Like

Hi @claire_snofox, this definitely looks like a bug. I tried disabling the submission if a select component within the form did not have a selection made:

The Module works like a charm within its own scope:

When I import the module in an App, it works the moment it's added to the canvas:

But it stops working after a page refresh:

We created an internal bug report for this issue and we'll let you know when it's fixed. On the meantime, we may need to recreate the form in multiple apps.

Thank you for surfacing! :slightly_smiling_face:

1 Like