Validate() function not working properly

Hello!

I have a strange problem in a form that I am building. Hopefully it's my fault but it really seem like a bug.

I have a form with some complex validation rules so I needed to do it in JS.

But when I try to run questionDetailsForm.validate() in my code it just shows an empty object:

{}

In the console:
image

Through JS:

image

image

Any ideas?

Thanks.

Hey @pedrocarloto!

form.validate() should return true or false depending on whether the form passes validation. The trick is that it does so in the form of a promise, if you examine the log in your browser console you'll see something like:

If you want to access the value of it in your JS code you can use await e.g.

const formValidated = await questionDetailsForm.validate()

Let me know if that works!

1 Like

Thank you for the quick answer.

Yes it works perfectly.

It would be great to see this kind of detail on your new "debug" window inside the platform! :slightly_smiling_face:

Definitely! We'll let you know here when promises are logged in more detail to the built-in debug console :slightly_smiling_face: