Buy Now
Sign in

Validation conflict with jquery

marianneC , June 13 2017, 13:59
M
marianneC 3
June 13 2017, 13:59 #369349
Hello,
I'm on joomla last version and I have an issue with my chrono forms validation. I had to add a jquery file in my theme, and it looks like it crashes the validation js. What can I do?

In the console:
"Uncaught TypeError: Cannot read property 'forms' of undefined
at HTMLFormElement.<anonymous> (e5cbf2c….js:683)
at Function.each (jquery.js:2)
at r.fn.init.each (jquery.js:2)
at Object.$.G2.forms.ready (e5cbf2c….js:681)
at HTMLDocument.<anonymous> (index.php?option=com_chronoforms6&view=form&Itemid=114:27)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at Function.ready (jquery.min.js:2)
at HTMLDocument.K (jquery.min.js:2)"
admin 29
June 13 2017, 22:47 #369361
Hello Marianne,

Where did you add this file reference exactly ? it should be added in the template <head>, if this doe not help then please send me a link to the form page so I can test this myself.

Best regards,
Max
M
marianneC 3
June 16 2017, 09:51 #369471
I use a template by YOOtheme. To add custom JS I have to put it in a specific folder. There is a theme.config.php there were I link the files

<?php

require(__DIR__.'/../../../layouts/theme.config.php');

// add script
$this['asset']->addFile('js', 'js:jquery.js');
$this['asset']->addFile('js', 'js:sidebar-fixed.js');

?>

I checked in the source code, it goes in the <head> section...
Attachments
Capture.PNG
Capture.PNG
(113.11 KiB)
736 Downloads/Views
admin 29
June 16 2017, 21:31 #369493
Hi Marianne,

Please try to remove the "jquery" file reference you have added as there is already a jquery file loaded on the page.

Best regards,
Max
M
marianneC 3
June 19 2017, 08:18 #369551
Then my custom JS only works on the page I put the form. It looks like you only load your jquery file on this page.
admin 29
June 19 2017, 10:39 #369557
Hi Marianne,

No, you have a jquery loaded by your website, its the first line in the screenshot you have already posted, Chronoforms uses that one, it does not load its own jQuery file.

Best regards,
Max