James Walford
James Walford

Reputation: 2953

Does Sitecore Webforms for Marketers have a JQuery dependency, and can it be changed?

Sitecore.NET 6.4.1 (rev. 111003) , web Forms For Marketers 2.2.0 rev.111104.

My site pages rely heavily on JQuery for, amongst other things, foldout navigation, launching and controlling animations, slideshows etc. and canvas effects of headings. We're using JQuery 1.6.1.

But when I insert a form into an item all the JQuery calls break.

Does Web Forms For Marketers have a JQuery dependency, and if so, can it be changed to use the version we're currently using?

EDIT:

I've found where the problem occurs, though still have no solution.

This is our navigation function (its opening at any rate)

 navigation: function () {

    $('#myNavElement')...stuff that gets done }

Where this:

$('#myNavElement') should return an element from jQuery.

Instead it's jumping into this function:

function $(element) {
if (arguments.length > 1) {
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
elements.push($(arguments[i]));
return elements;
}
if (Object.isString(element))
element = document.getElementById(element);
return Element.extend(element);
} 

From the file /sitecore/shell/controls/lib/prototype/prototype.js which is injected into the body tag by WFFM.

Upvotes: 1

Views: 911

Answers (2)

Mark Ursino
Mark Ursino

Reputation: 31435

Simply wrap your jQuery in the full jQuery function name. e.g.

jQuery('#myNavElement')

Another approach would be to wrap your entire custom jQuery script in a closure and pass in a local variable for the jQuery shorthand, e.g.

(function($){
  //  your existing code that used $ in here
})(jQuery);

Upvotes: 5

Ruud van Falier
Ruud van Falier

Reputation: 8877

Web Forms for Marketers only relies on jQuery for the back-end module and not for the front-end.

Upvotes: 2

Related Questions