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.
I am having two problems when opening a new popup:
#1 When i open a new popup to edit a node (edit/node/111) if the content type contains a data popup widget, i got an error "$(this).datepicker is not a function"
# When i have some functions from jquery ui (draggable / sortable) applyed into a list on a page and i click in a popup link on the page, after closing the popup window i am not able to use again jquery ui defined functions correctly. I keep receiving "sortable is not defined".
I have tried different strategies but i am unable to suceed. Any advices?
Thanks
Hernani
Comments
Comment #1
wanjee CreditAttribution: wanjee commentedHi,
Exact same issue for me.
I have a page with several important Javascript functionnalities. I also have a link on which popups_add_popups(...) has been used. Everything works fine until I open the popup. The popup opens and closes as it should but once closes I get errors with other functionnalities. Just like Hernani I keep receiving "foobar... is not defined" error message. In fact it looks like some of the libraries I use are not loaded anymore as soon as the popup as been opened ?
Why are my libraries unloaded ?
Any solution to fix this behaviour ?
Thanks,
Wanjee
Comment #2
wanjee CreditAttribution: wanjee commentedComment #3
wanjee CreditAttribution: wanjee commentedThe js files loaded by addJS function (in popups.js) do not include some of the files I use for other functionnalities.
So I think the flow is :
1. Main page loads all the required javascript (and my_file.js)
2. Popup opens and loads "some" javascript files including jquery.js (but not my_file.js). In the meantime all the functions I bound to jQuery (using jQuery.fn.my_func = function(){...} ) in my_file.js are not bound anymore to jQuery.
3. From this point every call to $('#item').my_func(); will lead to the error "$('#item').my_func(); is not a function"
My guess is that the files loaded at point number 2 are the one of the called page (the one inside the popup) as it works when I add my_file.js to the called page using drupal_add_js()...
I really don't want to include all the javascript file from the calling page into any potential called one so... is there a better solution ?
Comment #4
wanjee CreditAttribution: wanjee commentedDoes nobody have any idea about this problem? :(
Comment #5
rc2020 CreditAttribution: rc2020 commentedI can also confirm this problem.
Comment #6
catorghans CreditAttribution: catorghans commentedI see 2 possible solutions, but my Jquery knowledge is not good enough for building a proper patch.
-1 might be to use http://drupal.org/project/ajax_load (thanks to http://drupal.org/node/675922)
-2 to make use of the event "popups_open_path_done" which is triggered in popups.js after a popup is displayed, but I don't know how.
Comment #7
cbosco CreditAttribution: cbosco commentedHow to use the "popups_open_path_done" event:
Comment #8
operations CreditAttribution: operations commentedHi,
thank you cbosco & catorghans for the workaround ! I had a tooltip js not working on popups dialog, and fixed it using the popups_open_path_done binding :)
Comment #9
sjeandroz CreditAttribution: sjeandroz commentedHi,
where must we write this code?
In any js file who is loaded in the page before the popup is called?
Comment #10
operations CreditAttribution: operations commentedHi @sjeandroz,
Here is what I did:
Hope this helps ..
-- Mohannad
Comment #11
kenorb CreditAttribution: kenorb commentedMarked as duplicated of this: #462754: datepicker is not a function
Comment #12
kenorb CreditAttribution: kenorb commentedComment #13
kenorb CreditAttribution: kenorb commentedVersion 6.x is no longer supported due to Drupal 6 End of Life.