For some reason when i visited my site today, on one of my content types i found several errors.
1. My geolocation map on the node/add page has dissapeared
2. When i click on the Browse button for the media browser it doesnt pop up
3. The admin menu has gone from the top of the page to the bottom of the page
4. My WYSIWYG editor doesnt appear
Using Firebug i can see one error, and it says:
ReferenceError: compare is not defined
return compare(reference, value);
It is refering to the file /sites/all/modules/conditional_fields/js/conditional_fields.js?mlfdsp on line 36 which is:
return compare(reference, value);
Can someone help me? I really appreciate it
note. this only happens on one content type, one the rest of my content types i have WYSIWYG editors, maps and media browsers and all work fine.
Comment | File | Size | Author |
---|---|---|---|
#9 | conditional_fields_d7_1973320-11716869.patch | 908 bytes | Anybody |
| |||
#3 | geolocation.png | 54.39 KB | math_1048 |
Comments
Comment #1
prezaeis CreditAttribution: prezaeis commentedJust to note, switching conditional fields module off fixes my problems, so i know this is causing it
Comment #2
jackdaniel9 CreditAttribution: jackdaniel9 commentedWe had the same problem
Go to "Manage Dependecies"
Change ===== Context Setting -> Effect -> FadeIn / FadeOut to Show/ Hide
When you active FADEIN / FADEOUT :
Jquery Fail error "Compare" line 36
Comment #3
math_1048 CreditAttribution: math_1048 commentedHello,
I have this issue with Conditional field + Geolocation as shown in the picture
I think map need to be refreshed by some way...
please help me to fix this issue.
thanks and regards
Comment #4
jcmartinezThis is still happening when the effect is either slide or fade. It goes away when the conditional fields are using show/hide; so I'm switching mine for now to show/hide.
After inspecting the tag I noticed that some @import are missing when it doesn't work, mainly:
jquery_update/replace/ui/themes/base/minified/jquery.ui.core.min.css
jquery_update/replace/ui/themes/base/minified/jquery.ui.theme.min.css
jquery_update/replace/ui/themes/base/minified/jquery.ui.datepicker.min.css
Also, if you have configured more than one conditional field for the same content type the problem will not go away until you reconfigure all the conditionals to use show/hide.
Since I don't understand why this is happening I leave it here in case someone has any ideas.
Comment #5
AnybodyI can confirm this problem exists and is truely critical.
It appears in line 36 of conditional_fields.js due to a missing "compare" function dependency. Here's the code where the error happens:
Where does that "compare" function come from and how can we simply include it?
Comment #6
AnybodyBTW: The problem appears in the latest 7.x DEV and stable version.
Comment #7
AnybodyBTW2: All effects are already set to Show / Hide on my page. This is not a workaround for me.
Comment #8
AnybodyI finally invested some hours to investigate this in deep and finally it seems this may never have worked!
The technical reason for the problem is, that the compare() function, defined in Drupal core states.js is never accessible from conditional_fields.js!
function compare() is defined within the jQuery scope and not as global as it seems though.
I could not find a way to call compare() without hacking states.js and putting the "global" functions out of jQuery scope (behind closing "})(jQuery);").
Here you can find some more information the scope problem: https://www.sitepoint.com/community/t/jquery-calling-function-from-other...
So finally I found a workaround that should not have any negative impact but should fix the issue finally: We can access Drupal.states.Dependent.comparisons from conditional_fields.js which allows us to call the function:
which then calls compare() from within its scope!
That finally does what it should. => compare by value.
Here's my suggestion for a fix in conditional_fields.js:
Please review this and / or create a patch, if the solution is viable.
Thank you very much!
Comment #9
AnybodyHere's the patch from #8:
Comment #10
oschuetze CreditAttribution: oschuetze commented#9 works fine for me. Thanks!
Comment #11
sudishth CreditAttribution: sudishth as a volunteer and at Azri Solutions commented#9 is working for me
Comment #12
nachenko CreditAttribution: nachenko as a volunteer commented#9 works for me too
Comment #13
DanStorm CreditAttribution: DanStorm commentedOddly, this issue appeared for us after updating core from 7.63 to 7.66 ¯\_(ツ)_/¯ and #9 fixed it for us.
Comment #14
mavmark CreditAttribution: mavmark commented#9 TOTALLY fixed it for me. I spent hours digging through code and forums trying to find the answer. Thank you!
Comment #15
AnybodyThank you, any plans for a commit? Any active maintainer?
Comment #16
AnybodyComment #17
dqdThanks for all the hard work in here, the reports, the efforts, the new investigations regarding the underlying issue. All very much appreciated.
Reviewed and tested and committed to latest 7.x dev. Hope it still helps someone out there! But please consider updating Drupal to latest core since EOL of Drupal 7 is coming soon.
Comment #19
dqd