Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On some popups there is Javascript error:
$form.ajaxForm is not a function in popups.js?E (line 934)
--
openPathContent()("add/parent", "Parent Registration", "<form action="/add/parent?&destination=node%2Fadd%2Fchild" accept-charset="UTF-8"
...
</form>\n", a.popups-reference-0 parent?des.../add/child, Object updateMethod=none updateSource=initial, null)
Any clue why this happen?
Comment | File | Size | Author |
---|---|---|---|
#26 | 468218-jquery_update_support-25.patch | 614 bytes | igor.ro |
#25 | 468218-jquery_update_support-25.patch | 826 bytes | igor.ro |
#20 | popups_468218.patch | 1.67 KB | drewish |
#19 | popups_468218_jquery_update.patch | 1.04 KB | drewish |
#6 | 468218-popups-and-jquery_update.patch | 1.34 KB | DeFr |
Comments
Comment #1
kenorb CreditAttribution: kenorb commentedAnd when after close this Popup, cursor have loading icon.
Comment #2
slip CreditAttribution: slip commentedI had the same problem. Seems to be related to jquery.js being included twice.
In the Popups.addJS = function(js) in popups.js commenting out the following block gets rid of the error but could possibly cause other prolbems? Anyways, I'm reverting back to stable popups.
for (var i in scripts) {
var src = scripts[i];
if (!$('script[src='+ src + ']').length && !Popups.addedJS[src]) {
// Get the script from the server and execute it.
$.ajax({
type: 'GET',
url: src,
dataType: 'script',
async : false,
success: function(script) {
eval(script);
}
});
alert(src);
// Mark the js as added to the underlying page.
Popups.addedJS[src] = true;
}
}
Comment #3
JaceRider CreditAttribution: JaceRider commentedHey guys,
I believe I figured out what is going on here -- and the jquery_update module is at fault. I haven't delved into it very deeply, but jquery_update doesn't do it's thing until after the popups api has checked to see if jquery.js exists. So, on your initial page you have the jquery.js file being placed in there by jquery_update -- and on the newly loaded page called by popup api, you have the default jquery.js.
Popup api sees them as being different files (since they are in different places), and whalaaa, you have two version of jquery being loaded.
Hope this helps.
Comment #4
slip CreditAttribution: slip commentedI can't find the jquery twice in the source. Also popups 1.3 works.
Comment #5
sethcohn CreditAttribution: sethcohn commentedI did a quick hack, checking src for the jquery string, and skipping if so, and that works great.
for (var i in scripts) {
var src = scripts[i];
if (src.match('/misc/jquery.js')) {
Popups.addedJS[src] = true;
}
if (!$('script[src='+ src + ']').length && !Popups.addedJS[src]) {
Comment #6
DeFr CreditAttribution: DeFr commentedIn fact, it's a general compatibility with how jQuery Update alters the javascript files loaded, and the fact that Popups2 loads the missing JS files on demand: Popups sees the original path instead of the altered ones, and thus loads the original versions. This is obviously problematic with jquery.js, but with the dev version of jQuery Update that needs to also change ahah.js, its an even bigger problem.
It's solved in D7 with the shinny drupal_alter('js') added in #315801: JavaScript Patch #3: JS Alter Operation , but for D6 I would propose to check in popups_get_js if the jquery_update module exists, and if it does, use the replacements it defines.
One issue with this approach is that jquery_update_get_replacements returns the list of all the files it replaces except jquery.js. Attached patch deals with this problem by simply removing misc/jquery.js from the list of files that needs to be loaded. The rationale is that by the time we get in popups_get_js, we're inside a popup, which means that we've already used jQuery to open the popup and thus its already loaded.
Comment #7
DeFr CreditAttribution: DeFr commentedBumping this issue to a feature request, as it's not really a support request anymore.
Comment #8
hefox CreditAttribution: hefox commentedThe patch is working for me =)
Comment #9
starbow CreditAttribution: starbow commentedOk, so we have a community thumbs up. Giving the patch a quick eyeball, it looks good. I will roll this into the next 2.x release
Comment #10
tayzlor CreditAttribution: tayzlor commentedpatch in #6 did not completely fix the issue for me. Whilst it did not re-load the jqyery.js file, it added a bunch of other javascript files (both from my theme) + it reloaded the entire popups.js file again. This cause the popups to behave weirdly and basically screw up =)
Comment #11
DeFr CreditAttribution: DeFr commented@tayzlor: Just to be sure, those other js files are added both with and without the patch in #6 ? If so, are you doing something alike to jQuery Update in your theme, altering the path to the javascript files in a preprocess_page hook ?
I guess an easy check would be the following one: are the full path to the popups.js normally loaded on the page, and the one Popups tries to add to the page when you open a popup the same ?
Comment #12
tayzlor CreditAttribution: tayzlor commented@DeFr
without the patch in #6 , the extra js files are not loaded (a couple are, jquery.js , jquery_form.js) , with the patch, it does not load jquery.js again anymore, but it loads around 6 others, including popups.js again, which appears to break the popup stack.
I'm also not altering any paths to any js files in any preprocess functions, that im aware of.
Comment #13
DeFr CreditAttribution: DeFr commented@tayzlor: Another stab in the dark: do you have JavaScript files optimization turned on in admin/settings/performance ?
Comment #14
alextronic CreditAttribution: alextronic commentedThe patch is not working for me. I have jQuery Update enabled, applied the patch, but anything jQuery into the popup just doesn't work (jcarousel, tabs, validation, slimbox, etc). Nothing. I have JavaScript files optimization turned OFF, but changing this does not impact on anything at all.
Comment #15
alextronic CreditAttribution: alextronic commentedI have also tried the hacks above, and nothing. Please can anyone tell me why nothing jQuey is working inside the popups and how to solve this?... The patch was no use to me.
I tried reverting to the last stable version but it was all the same. These are my loaded scripts/libraries:
Thanks!!!
Comment #16
DeFr CreditAttribution: DeFr commented@alextronic: Javascript autoloading isn't implemented in the 1.x branch of popups, so unless the page calling the popups contains all the script needed by the popup, it won't work. This is fixed in the unstable 2.x branch of popups, which adds to the calling page all the scripts normally added to the popup page via drupal_add_js.
The patch attached to this issue fix one well identified potential issue when both jQuery Update and Popups are enabled on the same patch. If the JavaScript works in the popup with the stock 2.0-alpha5 release when you disable the JQuery Update module, and doesn't work when you both apply this patch and enable the jQuery Update module, then that's a problem with this patch. Otherwise, it's another issue entirely.
Looking at the code snippet you've posted, it looks like you're putting the javascript files directly in your theme page.tpl.php file, which isn't really supported by the popups approach that suppose the different JS files are added via drupal_add_js. It shouldn't be a complete showstopper at first sight though, because if you did put them in your page.tpl.php file, then they are loaded in the parent window...
(Btw, the correct value for the Javascript files optimisation is OFF for the autodetection of already loaded script to work, so your original setting shouldn't be the problem).
So to sum it up: disable the jQuery Update module, revert to the official 2.0-alpha5 release and check if it works.
Comment #17
alextronic CreditAttribution: alextronic commented"Disable the jQuery Update module, revert to the official 2.0-alpha5 release and check if it works" <- This worked, thanks.
I had to load the validation script from the node, but it worked in the end.
Now I'll try applying the patch and re-enabling jQuery Update.
Thank you
Comment #18
zerolab CreditAttribution: zerolab commentedBased on #5,
I added the following couple of lines and it works:
without !jQuery.browser.mozilla, jQuery tends to become unresponsive and crashes Firefox. This also solves the popups not showing under Safari/Chrome for me.
That, with the patch from #362878-11: jQuery 1.3.2 issue.
Comment #19
drewish CreditAttribution: drewish commentedHere's what we'd been using.
Comment #20
drewish CreditAttribution: drewish commentedActually had skipped a call to theme('page') where jquery_update does its JS manipulation. Committed the attached to DRUPAL-6--2.
Comment #21
DeFr CreditAttribution: DeFr commentedI'm confused by the call to theme('page'). I guess the goal is to trigger jQuery Update preprocess page ? The thing is, we can't really use it (and that's why the second hunk is still needed), because it all goes back straight to $vars['scripts'] as a big pile of
tags, and is then rendered into the page, where it's not that easy to extract and is totally ignored by the patch ? (The confusion also comes from the fact that we've been using the patch in #6 in production for 1+ year, without problem, and it doesn't call theme('page') :-)) Finally, now that the module is maintained again, I've got a few more patches to send your way ;-)Comment #22
drewish CreditAttribution: drewish commentedHumm... maybe you're right about the theme('page') not being needed for jQuery Update but I used that hook as a place to set the list of JS and CSS files for Drupal settings. So I guess we need to update the comment and not blame jquery_update, or move the part where I'm building the active stuff into popups_render_as_json().
Comment #23
tomvolek CreditAttribution: tomvolek commenteddrewish , et. all.
I still see this problem with popups not working if jquery_update is installed.
I am using the latest popups 6.x.2.x-dev and once I disable the jquery_update things work.
This is not acceptable to me as I need to use the jquery_update for alot of other things.
Is there any solution i can do the make poups module to co exist with jquery_update ?
Thanks
Tom
Comment #24
Azol CreditAttribution: Azol commentedThe only way that worked for me was providing Popups module with the jQuery library it was designed to work with:
1) copy misc/jquery.form.js file from your Drupal install into sites/all/modules/popups directory;
2) replace
with
in popups.module file.
Not a very elegant solution, but it works and allows me to continue using jQuery Update module as well. If Popups works only with particular jQuery version, we have to pre-pack one with the module itself.
Comment #25
igor.ro CreditAttribution: igor.ro commentedReplace for jquery update was commented and unset was not.
That is why jquery update module integration was wrong.
Here is the patch
Comment #26
igor.ro CreditAttribution: igor.ro commentedSorry previous patch was bugged.
Here is correct one.
Comment #27
llillf CreditAttribution: llillf commentedHi Igor,
Your patch works perfectly! Thanks first!
But have you noticed that after applying the patch, all the submission get a "Bad Response form submission" message after submit, no matter if the submission is correct or not? Could you give me a little hint why that happens and how to solve it?
Thanks a lot!!!!!!!!!!!!!!1
Comment #28
igor.ro CreditAttribution: igor.ro commentedI do not think that your problem related to my patch.
Could you roll it back and test again?
Comment #29
kenorb CreditAttribution: kenorb commentedVersion 6.x is no longer supported due to Drupal 6 End of Life.