I'm running Commerce Kickstart with a recently updated Drupal 7.9. I'm finding that the site's javascript comes to a grinding halt with "Error: uncaught exception: Syntax error, unrecognized expression:" and no further information. I'm not currently running any scripts on the site other than the modules I've installed.

I've been able to track it down to the field group module; When I switch off everything except field group, the error still occurs, but when I switch off field group the error stops. Other than that, I can't say what the problem is. I've included a screenshot of both the javascript console and a test from the testing module.

Comments

Stalski’s picture

A patch would be very welcome! Thx in advance

nils.destoop’s picture

Can you provide me access to your site?

nils.destoop’s picture

As jquery.js also give warnings. I think something is wrong with your installation.

isagarjadhav’s picture

I am also facing similar issue. Not able to trace exact line of error though. after disabling field group module everything works fine.

P.S - I have update my JQuery version using jquery update module.

Need urgent fix for this.

Vote_Sizing_Steve’s picture

I don't have the time to go through my connected modules to disable the field group module, but can offer that I get this error only for unauthenticated users (http://ivotesize.com/en/node/add/ivotesize-survey) - signed in users get all the js to work.

nils.destoop’s picture

Where you able to fix it? I don't see any js errors on the survey form.

Stalski’s picture

Status: Active » Postponed (maintainer needs more info)

We really need more information to get into this. A simple clean drupal with a feature of some kind is good enough, we need to reproduce it.

Can you also check if it might be fixed in the dev snapshot?

pianomansam’s picture

Status: Postponed (maintainer needs more info) » Active

Background

I recently ran into a similar situation, with the same exact JavaScript error. Using Chrome developer tools (http://cl.ly/image/0n0l102S0H2j), I was able to trace the issue back the the collapsible setting on my fieldset. I went and looked at the settings for that fieldset, and noticed that this particular fieldset had no label. When I added a label for it, the error went away.

Summary

This issue (at least for me) is the result of having a collapsible fieldset without a label.

Recommendation

Make a label required if a fieldset is collapsible or collapsed, since this functionality requires a label to be present.

lendude’s picture

problem for me arose when going to an URL with a multipage fieldgroup where de URL had a trailing # and nothing behind the # (so an URL for jump-to-top)

The following code was the problem (line 57 in multipage.js):

if (window.location.hash && $(window.location.hash, this).length) {
  paneWithFocus = $(window.location.hash, this).closest('.multipage-pane');
}

window.location.hash would return just a #, and jQuery will get called with $('#'), throwing an error

so for me the fix is adding an extra check

if (window.location.hash && window.location.hash != '#' && $(window.location.hash, this).length) {

Don't know if this was the issue for others, but this is what caused this error for me

Len

Stalski’s picture

Status: Active » Fixed

The problem in #8 can not easily be fixed as the required property should run with server side which we don't have in "onchange" events in the configuration form. We might solve it with javascript but I would need to look into that to add some js functionality.
I solved the problem by adding a description and the possibility to do so. It simple suggest you need a title for collapisble elements.

The second problem is actually a good suggestion. This should not be possible indeed. Committed that as well.

thx for the report.

pianomansam’s picture

Stalski, I'm slightly confused what you fixed and what is unfixable in your mind. The solution I propose in #8 is a server side validation of the fieldset settings, ensuring that if a fieldset is set to collapsible it also has a title.

pjcdawkins’s picture

@Stalski, I don't understand what fix you committed, because the diff is 112KB - huge and unreadable.
http://drupalcode.org/project/field_group.git/commitdiff/51c972aebbd53e0...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pianomansam’s picture

Status: Closed (fixed) » Needs review

Still looking for details from Stalski, therefore this still needs review...

tobiasb’s picture

Issue summary: View changes
StatusFileSize
new97.49 KB

The changes without Line-endings changes:

diff --git a/field_group.field_ui.inc b/field_group.field_ui.inc
index 47d5eb9..33aa5da 100644
--- a/field_group.field_ui.inc
+++ b/field_group.field_ui.inc
@@ -425,7 +425,12 @@ function field_group_format_settings_form(&$group) {
     '#weight' => -5,
     '#element_validate' => array('field_group_format_settings_label_validate'),
   );
-  $form += module_invoke_all('field_group_format_settings', $group);
+  $addition = module_invoke_all('field_group_format_settings', $group);
+  $form += $addition;
+  // Give fieldgroup implementations the chance to alter the description.
+  if (!empty($addition['label']['#description'])) {
+    $form['label']['#description'] = $addition['label']['#description'];
+  }
   $form['#validate'] = array('field_group_format_settings_form_validate');
   return $form;
 }
diff --git a/field_group.module b/field_group.module
index f2f9468..1f5db92 100644
--- a/field_group.module
+++ b/field_group.module
@@ -513,6 +513,7 @@ function field_group_field_group_format_settings($group) {
       );
       break;
     case 'div':
+      $form['label']['#description'] = t('Please enter a label for collapsible elements');
       $form['instance_settings']['show_label'] = array(
         '#title' => t('Show label'),
         '#type' => 'select',
@@ -551,6 +552,7 @@ function field_group_field_group_format_settings($group) {
       );
       break;
     case 'fieldset':
+      $form['label']['#description'] = t('Please enter a label for collapsible elements');
       break;
     case 'multipage-group':
       $form['instance_settings']['page_header'] = array(
diff --git a/horizontal-tabs/horizontal-tabs.js b/horizontal-tabs/horizontal-tabs.js
index 4926b19..b48105d 100644
--- a/horizontal-tabs/horizontal-tabs.js
+++ b/horizontal-tabs/horizontal-tabs.js
@@ -50,7 +50,7 @@ Drupal.behaviors.horizontalTabs = {
       if (!tab_focus) {
         // If the current URL has a fragment and one of the tabs contains an
         // element that matches the URL fragment, activate that tab.
-        if (window.location.hash && $(window.location.hash, this).length) {
+        if (window.location.hash && window.location.hash !== '#' && $(window.location.hash, this).length) {
           tab_focus = $(window.location.hash, this).closest('.horizontal-tabs-pane');
         }
         else {
diff --git a/multipage/multipage.js b/multipage/multipage.js
index 321d95d..591e0ac 100644
--- a/multipage/multipage.js
+++ b/multipage/multipage.js
@@ -54,7 +54,7 @@ Drupal.behaviors.MultiPage = {
       if (paneWithFocus === undefined) {
         // If the current URL has a fragment and one of the tabs contains an
         // element that matches the URL fragment, activate that tab.
-        if (window.location.hash && $(window.location.hash, this).length) {
+        if (window.location.hash && window.location.hash !== '#' && $(window.location.hash, this).length) {
           paneWithFocus = $(window.location.hash, this).closest('.multipage-pane');
         }
         else {

I added a patch which changes all CRLF to LF. Windows user should run this command: git config --global core.autocrlf true.

Status: Needs review » Needs work

The last submitted patch, 15: field_group-1358430.patch, failed testing.

tobiasb’s picture

StatusFileSize
new97.49 KB

Now without filemode changes.

tobiasb’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 17: field_group-1358430.patch, failed testing.

tobiasb’s picture

Ok just change all CRLF to LF. Thx ;-)

pianomansam’s picture

@tobiasb, what is your patch attempting to do?

tobiasb’s picture

@pianomansam

It changes all CRLF to LF, and some whitespace, but testbot do not love it. ;-)

oushen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.68 KB

Status: Needs review » Needs work

The last submitted patch, 23: field_group-1358430-23.patch, failed testing.

oushen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.68 KB

Status: Needs review » Needs work

The last submitted patch, 25: field_group-1358430-25.patch, failed testing.

The last submitted patch, 25: field_group-1358430-25.patch, failed testing.

oushen’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.74 KB

Need remove some chars from url hash before use it in jQuery.

  var hash = window.location.hash.replace(/[=%;,\/]/g,"");
  if (hash !== '#' && $(hash, this).length) {
    tab_focus = $(hash, this).closest('.horizontal-tabs-pane');
  }
pianomansam’s picture

@agpsoftdev what are you attempting to do with this patch?

oushen’s picture

@pianomansam

patch replace

if (window.location.hash && window.location.hash !== '#' && $(window.location.hash, this).length) {
  tab_focus = $(window.location.hash, this).closest('.horizontal-tabs-pane');
}

by

var hash = window.location.hash.replace(/[=%;,\/]/g,"");
if (hash !== '#' && $(hash, this).length) {
  tab_focus = $(hash, this).closest('.horizontal-tabs-pane');
}
nils.destoop’s picture

Status: Needs review » Fixed

Ok, i see why you are doing this. To make sure no wrong formatted selectors are used. Committed it to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

  • Commit 51c972a on 7.x-1.x, 8.x-1.x by Stalski:
    Issue #1358430 by FriedJam: Fixed JS 'Error: uncaught exception: Syntax...
  • Commit ead74fb on 7.x-1.x, 8.x-1.x authored by oushen, committed by zuuperman:
    Issue #1358430 by oushen, tobiasb | FriedJam: JS "Error: uncaught...

Status: Closed (fixed) » Needs work

The last submitted patch, 28: field_group-1358430-27.patch, failed testing.

nils.destoop’s picture

Status: Needs work » Closed (fixed)