Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#8993 closed bug (duplicate)

missing instance data for this datepicker when using datepicked with swfobject or object tag

Reported by: neaglets Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.8.23
Keywords: Cc:
Blocked by: Blocking:

Description

This ticket is in relation to http://bugs.jqueryui.com/ticket/8424 which is marked as closed but I cannot re-open.

We also experienced the exact same issue: it occurred while using jquery-ui datepicker and uploadify (which uses flash and therefore an object tag). IE 9 only.

We 'fixed' this issue for our purposes by modifying our version of the jquery-ui code - we removed the following exception code:

throw"Missing instance data for this datepicker"

This prevents jquery-ui from throwing the exception which means uploadify can continue and won't be affected. But obviously this is not a fix for the actual issue, just a work-around.

We attempted to debug jquery-ui to see if we could provide a fix, but it would probably take someone more familiar with the datepicker control to do the right thing.

We found that it seems to be caused by the fact that the datepicker code hooks into click events elsewhere on the page in order to make sure it hides any open instances of the datepicker control. However, if that click takes place on uploadify (i.e. an object tag) then it cannot get a reference to the document and/or datepicker so it throws the exception above which stops uploadify itself from executing.

To replicate this, you would need:

  • IE9
  • A datepicker control and uploadify on the same page
  • Activate the datepicker and then try and use uploadify - it won't work

Although this was originally discovered in v1.8.23, we also tried v1.10.0 and found the same issue.

Change History (2)

comment:1 Changed 7 years ago by Scott González

Resolution: duplicate
Status: newclosed

Duplicate of #8424.

To replicate this, you would need...

What we will need is a reduced test case, which is exactly what we asked for in the previous ticket. If you can provide a reduced test case on the original ticket, we will re-open it.

Last edited 7 years ago by Scott González (previous) (diff)

comment:2 Changed 7 years ago by adry803

Hey, I just bumped into this issue today and it can be fixed using a workaround when loading your uploadify component:

if ($.browser.msie && '9.0' === $.browser.version) {
   //Redefining datepicker's getInst function if ie9
   $.datepicker._getInst = function(target) {
      try { 
	   if ('object' === target.nodeName.toLowerCase()) {
	      return false; 
           } 
      return $.data(target, 'datepicker'); 
      } 
      catch (err) { 
           throw 'Missing instance data for this datepicker'; 
      } 
   }; 
}

Source: http://fjcanyue.blogspot.hk/2012/09/jquery-ie9-getattribute-from-html.html

So I think this is not a jQuery bug, but a datepicker bug.

I hope it helps somebody out there!

Note: See TracTickets for help on using tickets.