Forums

Form does not validate in module

tfk 06 Apr, 2012
I am using the most recent versions of Chronoforms and Joomla.

When I click the Frontend View link, my form validates (all three fields are required): http://pactweb.org/index.php?option=com_chronoforms&chronoform=PACTlogo

When the form is in a module, or within the article using the {chronoforms} plugin, it does not validate: http://pactweb.org/index.php/contest

I tried another form that includes a Captcha, and in the module it displayed the Captcha error message, but also submitted the form (and sent the email attached to the submit event).

Am I overlooking something?

Thanks,
Walt
GreyHead 06 Apr, 2012
Hi Walt,

Your template (or some other component) is loading the jQuery JavaScript library.

Out of the box jQuery isn't compatible with the MooTools library used by Joomla! and ChronoForms. You can use jQuery with MooTools in no-conflict mode. There are various ways of doing this. The simplest - which may or may not work - is to add a line of script in the ChronoForms Form JavaScript box:
jQuery.noConflict();
This will free the $ operator which is used by MooTools, so you may need to update your own javascripts to use the longer jQuery operator.

There is also a neat plugin named JB Library from Joomla! Bamboo that allows you to control on which pages jQuery is loaded, and will always load it in no-conflict mode. However this requires that JQuery is loaded using the Joomla Document object methods.

I have a tutorial on Resolving jQuery problems that explores some of the issues an diagnostics and shows how to modify one template example to use the Joomla! Document methods to load JQuery in noConflict mode.

Bob
tfk 06 Apr, 2012
Thanks, Bob, the plugin that I'm using to display the image galleries on the page must be loading the jQuery--it validates when I take them off. Adding the line to the JS box on load doesn't help.

I'll go through the tutorial and try the JB Library--unless you have a quicker suggestion.
GreyHead 06 Apr, 2012
Hi tfk,

Unfortuantely there is no reliable 'quick fix' to jQuery conflicts. A lot depends on how the extension that uses JQuery has been written as you have to set the noConflict after JQuery loads and before any MooTools code runs. It also doesn't help that (unlike WordPress) Joomla! doesn't have a better file loader that can manage dependencies.

Bob
tfk 07 Apr, 2012
Thanks, Bob, I appreciate the explanation. I'll put the form on a different page.
This topic is locked and no more replies can be posted.