MauticFormCallback is not defined

Your software
My Mautic version is: 4.4.12
My PHP version is: 8.0
My Database type and version is: mariadb 10.6

Your problem
My problem is: I’m trying to add custom JS validation using Mautic’s JS API, but I’m getting the following error in the console:

MauticFormCallback is not defined

I’ve been following this guide: Mautic Developer Documentation

These errors are showing in the log: nothing in the logs

Steps I have tried to fix the problem:

  1. Create a form
  2. Add the html field and add your validation code
  3. Check the console for the error