1

we recently migrated to Sitecore 9.1 from 8.1 and we see a bunch of JS errors on the page only in experience editor mode. I dont see them happening in the normal mode.
I tried replacing the Sitecore vanilla js files - still the same.

there are two majors errors that I see getting repeated all over :

Uncaught TypeError: Cannot read property 'hide' of undefined

and

Uncaught TypeError: Cannot read property 'replace' of undefined

Any idea why this might happen?

enter image description here

  • Do you use prototype/jQuery libraries on your website? If yes, then make sure that you use no-conflict mode kb.sitecore.net/articles/286042 My assumption that should be checked: newer version of Sitecore scripts conflicts with yours. – Anton Jul 10 at 20:53
  • Are you using VueJs for front end? If yes then you can use my recent research... sitecore.stackexchange.com/questions/22108/… – Yogesh Sharma Sep 27 at 8:11
  • Also try just removing JS references from Exepreince editor and you will see you won't get these error anymore – Yogesh Sharma Sep 27 at 8:12
0

For us, the problem was an Html.Glass().Editable(...) inside the href of a link. That did not break the Experience Editor in Sitecore 8.1.

The init method of Sitecore.PageModes.ChromeManager throws an error, the initialization fails and the Experience Editor is unusable. That is the first error:

Uncaught TypeError: Cannot read property 'replace' of undefined

To find that, I used the Google Chromes DevTools (Firefox did not work for me). I added a logpoint on line 8347 ($sc.removeTags(this.fieldValue[0].defaultValue.replace(...)) inside Sitecore.PageModes.ChromeTypes.Fields load method and logged the following:

'fieldValue[0].id:', this.fieldValue[0].id

Now, reload the Experience Editor and look for the last id before the uncaught error.
Search for that id in your HTML using DevTools.

P.S.: You may have multiple sources for that error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.