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.

Comments

Thanks 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.

I'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.

It 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.

I'm not using panels but i have also problems with date picker

Error: $calendar.datepicker is not a function
Sourcei: ...sites/all/modules/webform/js/webform.js?O
Line: 33

webform.js is called before jquery.ui package. Could this be the problem?

Status:Active» Postponed

I'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.

Version:7.x-3.0-beta5» 6.x-3.2
Status:Postponed» Active

Moving 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:

  if (function_exists('date_popup_load')) {
    date_popup_load();
  }

at line 1349 in webform.module.

Still encountering the same problem.

Thanks 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!

Status:Active» Postponed (maintainer needs more info)

I 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.

Status:Postponed (maintainer needs more info)» Fixed

I'm marking this fixed, as it should be corrected in Webform 3.3 and higher. Please reopen if the problem continues to exist.

It does seem to be fixed, thanks!

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Active

It is still not fixed and breaks still the latest version of panels...

Status:Active» Postponed (maintainer needs more info)

I don't use Panels so I'll be dependent on a patch from some other user.

Version:6.x-3.2» 7.x-3.13

Using 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.

Same 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.

Status:Postponed (maintainer needs more info)» Closed (won't fix)

@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).

Version:7.x-3.13» 6.x-3.10

I had this same issue 6x-3.10 and your post helped us discover a solution. Thanks!

Status:Needs review» Closed (won't fix)
StatusFileSize
new5.34 KB

This 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:

var $calendar = $webformDatepicker.find('input.webform-calendar');

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...

Version:6.x-3.10» 6.x-3.18
Status:Closed (won't fix)» Needs review

Switching to needs review...

Status:Closed (won't fix)» Needs review

Thanks dsayswhat!

Maybe we could just add a return at the top of the function?

if ($calendar.length == 0) {
  return;
}

StatusFileSize
new807 bytes

Ah - naturally. Of course that's better.

Here's the revised patch.

Status:Needs review» Fixed

Excellent thanks! Committed to Webform 3.x and 4.x branches.

Status:Fixed» Closed (fixed)

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