NullPointerException
NullPointerException

Reputation: 489

$scwhead is not defined in Sitecore Web Forms for Marketers

On the contact page I have created and placed WFFM form. The code which is generated for the form looks like this:

$scwhead.ready(function() {$scw('#form_0747B7A0DDB27BDEB97C7E23A').webform({...

However, the following error appears in JavaScript console.

Uncaught ReferenceError: $scwhead is not defined

I have searched for references in my solution folder but haven't found any.
What could be causing the problem and where this piece of code is being generated?

Upvotes: 1

Views: 737

Answers (2)

Chasden
Chasden

Reputation: 161

I'm also seeing the "$scw is not defined" JavaScript error on our implementation of Sitecore 6.6. We just updated to WFFM 2.3 (140617) last night. We are not using MVC Layouts.

UPDATE: This issue was solved for us after we found that the sc.webform.js file was not current. There was an problem with how the upgrade package installed the dlls and JavaScript. These needed to be manually updated. Once we had the correct version of that js file there were no more JavaScript errors.

Upvotes: 1

Thomas Therkildsen
Thomas Therkildsen

Reputation: 150

Are you using a MVC (cshtml) Layout? There are many bugs in the current version (2.4 rev.141008) of WFFM for MVC Layouts.

One of the bugs is about scripts missing on the form front-end.

Until a update comes, the workaround is to add these bundles to the \Views\Form\Index.cshtml file:

@Scripts.Render("~/bundles/wffm/jquery")
@Scripts.Render("~/bundles/wffm/scripts")
@Styles.Render("~/content/wffm/jquery")
@Styles.Render("~/content/wffm/themes")

Does this help?

Upvotes: 1

Related Questions