Fd.validate is not a function

Hi,

I have a custom submit function connected to a button on the form. The submit function works fine, however my issue is that it's not running my custom validation functions until I call the fd.save() function and I don't want the rest of the code in my save function to run unless the form is valid.

Therefore, the first action I want to run in this function is to check the form is valid before running any of the other code.

In this forum post How to use button for validation? - #2 by mnikitina you reference that fd.validate() should validate the form, however when I add fd.validate(); to the first line of my submit function the console returns fd.validate is not a function.

How can I check the form is valid before running the rest of my code in the custom submit function?

Thanks

Hello @Andrew,

The API has changed since this post. You can find all available methods and properties in our documentation.

Please use the fd.isValid property instead. And if you want to call the property on button click, you need to define fd globally like this:

window.fd = fd;

fd.spRendered(function () {
   //your code 
});

Hi @mnikitina,

Ah yes of course, thanks for pointing me in the right direction

1 Like