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.
From #71131-72: Add popup calendar to date component by devkinetic:
This functionality breaks the panels module.
Create a webform with a date field and this popup enabled. Add it to a panels page (full not teaser). Save.
Return to the editing of the panel page and pop open firebug. The following error is returned:
$calendar[0] is undefined
var startYear = $calendar[0].class...bform-calendar-start-(\d+).*/, '$1');
Now when you edit the settings of any panels component (the modal that pops up) and hit the finish button, the modal will never close and firebug will display the above noted error.
Comment | File | Size | Author |
---|---|---|---|
#21 | webform-js-bulletproofing-832952-21.patch | 807 bytes | dsayswhat |
#18 | webform-js-bulletproofing-832952-17.patch | 5.34 KB | dsayswhat |
Comments
Comment #1
devkinetic CreditAttribution: devkinetic commentedThanks for moving this quicksketch.
Just as a note, I experienced this in 6.x. Upon looking at the source code of the panel editing page, the div.webform-datepicker exists (this triggers the datepicker function) while...
var $calendar = $webformDatepicker.find('input.webform-calendar');
...is not found. I suggest inserting an if statement here, which would only continue processing if the find returned true.
Comment #2
quicksketchI'd rather find why the element is missing instead of just skipping the processing entirely. Unfortunately I don't use Panels (or haven't any time recently) and I'm unlikely to fix this problem unless a patch is provided.
Comment #3
devkinetic CreditAttribution: devkinetic commentedIt doesn't look like the panel doesn't fully render the webform unless you are on the "preview" page. It does generate (and hide) the container elements though, which is the issue in this case.
Comment #4
checker CreditAttribution: checker commentedI'm not using panels but i have also problems with date picker
webform.js is called before jquery.ui package. Could this be the problem?
Comment #5
quicksketchI'm not updating Webform to "chase" Drupal 7 any more, any patches would be appreciated. But considering both Panels and Drupal 7 are extremely alpha, and that I don't use Panels, I wouldn't expect this to get fixed any time soon.
Comment #6
grasmash CreditAttribution: grasmash commentedMoving to active because I'm experiencing the same error in 6.x-3.2 (not a 7.x issue only). Changing module weights doesn't change js call order. The error breaks all following JS.
UPDATE: I tried manually adding the datepicker JS files before webform.js is called. This did not fix the problem. Maybe my solution was too crude? I added:
at line 1349 in webform.module.
Still encountering the same problem.
Comment #7
quicksketchThanks for your research on this madmatter23. Could you post a new comment with every update instead of editing your comment? Then we can see the whole thought process worked out as you make progress. Thanks!
Comment #8
quicksketchI think this problem may have existed because both webform.js and webform-admin.js tried to define
Drupal.behaviors.webform
. If you had both loaded at the same time, either one or the other might not work. I'm not sure what JS files Panels loads onto the page, but if it's loading both this could be the culprit. This problem has already been fixed in CVS, so perhaps the next version of Webform (3.3) will fix this problem. I don't use Panels, so any reports of this problem being fixed (or not) by the latest CVS version of Webform would be appreciated.Comment #9
quicksketchI'm marking this fixed, as it should be corrected in Webform 3.3 and higher. Please reopen if the problem continues to exist.
Comment #10
grasmash CreditAttribution: grasmash commentedIt does seem to be fixed, thanks!
Comment #12
ayalon CreditAttribution: ayalon commentedIt is still not fixed and breaks still the latest version of panels...
Comment #13
quicksketchI don't use Panels so I'll be dependent on a patch from some other user.
Comment #14
parijke CreditAttribution: parijke commentedUsing a date-popup in the webform causes panels UI to break with 7.x-3.13 as well. Disabling the popup and the page works fine.
Comment #15
ben@ferraro.ca CreditAttribution: ben@ferraro.ca commentedSame issue but it appears to be browser related handling. I am using Drupal 7.8 without Panels.
I'm investigating the potential of a CSS related issue that may exist with Date and Date Pop-up that used to exist back with IE6. I have no issue when I attempt to use the pop up with Safari but do with IE9/IE8 & FireFox. Using IE9 or FireFox attempts to submit the form.
Comment #16
quicksketch@parijke and @ben@ferraro.ca: You guys are actually reporting #1285342: Date Popup causes JavaScript error on IE8/9.
I'm closing this issue because no one seems interested or able to provide a patch to make the popup calendar work in Panels (or maybe it does work now, due to a fix on their end).
Comment #17
jansenCreative CreditAttribution: jansenCreative commentedI had this same issue 6x-3.10 and your post helped us discover a solution. Thanks!
Comment #18
dsayswhat CreditAttribution: dsayswhat commentedThis patch fixes the panels error for D6.
The problem I fixed here was simply to get the panels buttons working again. That seems to be the most pressing issue here.
The problem in webform.js was:
returns empty in panels, because the markup isn't rendered fully in the panels interface - webform-datepicker is apparently there, but the input.webform-calendar is not, when managing a panel.
The fix is simply to test the length of $calendar before utilizing it...
Comment #19
dsayswhat CreditAttribution: dsayswhat commentedSwitching to needs review...
Comment #20
quicksketchThanks dsayswhat!
Maybe we could just add a return at the top of the function?
Comment #21
dsayswhat CreditAttribution: dsayswhat commentedAh - naturally. Of course that's better.
Here's the revised patch.
Comment #22
quicksketchExcellent thanks! Committed to Webform 3.x and 4.x branches.