Zebra_Form icon indicating copy to clipboard operation
Zebra_Form copied to clipboard

interoperating with jQuery noConflict()

Open CBCNewMedia opened this issue 11 years ago • 2 comments

The jQuery function noConflict() removes the global references to jQuery so that you can safely use multiple versions of jQuery on a single page (multiple jQuery libraries is a necessary evil if you're working with a lot of third party embedded content).

The Zebra Form javascript code that is written out to the HTML page depends on the globals jQuery and $. If you're using noConflict(), those won't be available, and the client side validation won't work.

It would be great if we could specify an alternate name for jQuery. That way, we could safely put a reference to jQuery somewhere that Zebra Form can get to it.

Even better would be if all this code could run cleanly inside of a require.js module. We've wrapped up the static Javascript files in a require.js module, but that dynamically generated code is tricky. You would have to build a data structure with all the form's rules and make that available somehow to the require.js module. It's doable, but it's a pretty large change.

CBCNewMedia avatar Nov 25 '13 21:11 CBCNewMedia

I am open to suggestions - even better, I accept pull requests! :) Having the code inside a require.js module makes everything too particular, but maybe an extra property given to the clientside_validation method is what we need

stefangabos avatar Nov 25 '13 21:11 stefangabos

If somebody wants a temporary solution: Just search for "$(" in Zebra_Form.php and replace all with "jQuery(". This did resolve the errors in the console for me.

SimonMayerhofer avatar Dec 18 '15 12:12 SimonMayerhofer