Title: [Plugin: Google Calendar Widget] JavaScript error in Wiki.js apply()
Last modified: August 20, 2016

---

# [Plugin: Google Calendar Widget] JavaScript error in Wiki.js apply()

 *  [Steve](https://wordpress.org/support/users/spritchardcsvorguk/)
 * (@spritchardcsvorguk)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-google-calendar-widget-javascript-error-in-wikijs-apply/)
 * I’ve just installed Google Calendar Widget on my WordPress server ([wp.a2nipswich.org.uk](http://wp.a2nipswich.org.uk/)).
   It displayed the list of events ok, but when I clicked on an event to get the
   full details, nothing happened.
 * Browser is Chrome 22.0.1229.79 m, although I also tried it with IE 8 and had 
   the same problem.
 * Digging down with the Chrome Developer tools, I discovered that a JavaScript 
   exception was occurring in apply() in Wiki.js (line 191): undefined method ‘rex’.
 * Digging further, it turned out that there was a problem with the loop “for (var
   i in rules)”: it worked ok if ‘rules’ had multiple elements, i went 0 1 2 3 etc;
   however if ‘rules’ had only one element, i was set to “toJSON” (rather than 0)
   which meant that rules[i] is undefined.
 * This may be a bug in Chrome, I haven’t had time to debug on other browsers.
 * I tried to reproduce the problem with the example calendars at [http://notions.okuda.ca/wordpress-plugins/google-calendar-widget/](http://notions.okuda.ca/wordpress-plugins/google-calendar-widget/),
   however these don’t have enough data (location, description) to trigger the problem–
   str is blank when apply() is called.
 * I’ve found a simple fix which seems to get round the problem – change the for
   loop to:
 * > for (var i = 0; i < rules.length; i++) {
 * [http://wordpress.org/extend/plugins/google-calendar-widget/](http://wordpress.org/extend/plugins/google-calendar-widget/)

The topic ‘[Plugin: Google Calendar Widget] JavaScript error in Wiki.js apply()’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/google-calendar-widget.svg)
 * [Google Calendar Widget](https://wordpress.org/plugins/google-calendar-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-calendar-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-calendar-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/google-calendar-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-calendar-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-calendar-widget/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Steve](https://wordpress.org/support/users/spritchardcsvorguk/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-google-calendar-widget-javascript-error-in-wikijs-apply/)
 * Status: not resolved