Mautic Community Forums

Form is not working for us

Your software Mautic 4
My PHP version is : 7.4
My MySQL/MariaDB version is (delete as applicable): MySQL/MariaDB version: 8.0

These errors are showing in the Mautic log : none found

Your problem
My problem is : Javascript error on a different domain name other than where Mautic is installed on.

Steps I have tried to fix the problem : The error did show about CORS so I took this disabled CORS, Add domain name in the CORS setting. This error went away however the other two error still remains and I can’t find or figure what causing this error

Test page to see or test the error - BTG Test Form

Domain Mautic is installed on - https://deafcoder.com/

Here the first error:

VM441:1 Uncaught SyntaxError: Unexpected token } in JSON at position 12
at JSON.parse ()
at Object.Core.parseToObject (mautic-form.js?v1ced89cf:47)
at mautic-form.js?v1ced89cf:48
at mautic-form.js?v1ced89cf:49

And the second error:

Uncaught TypeError: Cannot read properties of undefined (reading ‘btgsubscriptionform’)
at Object.Form.prepareValidation (mautic-form.js?v1ced89cf:8)
at Object.Form.prepareForms (mautic-form.js?v1ced89cf:6)
at Object.Core.onLoad (mautic-form.js?v1ced89cf:47)
at HTMLScriptElement.script.onload (:1:491)
Form.prepareValidation @ mautic-form.js?v1ced89cf:8
Form.prepareForms @ mautic-form.js?v1ced89cf:6
Core.onLoad @ mautic-form.js?v1ced89cf:47
script.onload @ VM434:1
load (async)
(anonymous) @ VM434:1
(anonymous) @ generate.js?id=1:11

1 Like

Can anyone help us with this one?

I have same problem,
Mautic4 & PHP7.4
Mautic3.3.4 & PHP7.4

have 2 errors,
first ==> Uncaught SyntaxError: Unexpected token } in JSON at position 12
@ return JSON.parse(’{"’ + decodeURI(params.trim().replace(/&/g, “”,"").replace(/=/g, “”:"")) + ‘"}’);

second ==> Uncaught TypeError: Cannot read properties of undefined (reading ‘testforms’)
@ if (typeof window.MauticFormValidations[formId] == ‘undefined’) {