Skip to main content

Search and Top Navigation

#8121 open bug ()

Opened February 17, 2012 09:01AM UTC

Last modified June 24, 2014 11:50PM UTC

Datepicker: Focusing multiple elements at the same time throws an error.

Reported by: tojocky Owned by: tojocky
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.8.17
Keywords: Cc:
Blocked by: Blocking:
Description

Hello,

When I upgraded to the latest release 1.8.17 I have an error on submit button on line:

https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js#L644

This error is prompt because $.datepicker._curInst is null. This value seems to be nulled by calling $.datepicker._curInst.dpDiv.stop(true, true); method from:

https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js#L642

As a temporary solution I found to rewrite the line:

https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js#L643

from:

#!js
if ( inst && $.datepicker._datepickerShowing ) {

into:

#!js
if ( $.datepicker._curInst&&inst && $.datepicker._datepickerShowing ) {

I didn't had time to debug more deep. Maybe this is not the right patch.

I use jQuery 1.7.2.pre where "this" is changed by this line:

https://github.com/jquery/jquery/blob/master/src/queue.js#L116

Attachments (0)
Change History (10)

Changed February 17, 2012 12:55PM UTC by scottgonzalez comment:1

component: ui.coreui.datepicker
owner: → tojocky
status: newpending

Please provide a reduced test case showing the problem.

Changed February 20, 2012 04:14PM UTC by tojocky comment:2

_comment0: I cant attach the source-codee example1329754519507905
status: pendingnew

I can't attach the source-code example

Changed February 20, 2012 04:21PM UTC by tojocky comment:3

Changed February 20, 2012 09:40PM UTC by scottgonzalez comment:4

status: newopen
summary: $.datepicker._curInst have no property input in _showDatepicker methodDatepicker: Focusing multiple elements at the same time throws an error.

The error comes from focusing multiple datepicker fields in the same event loop. You should file a bug against that validation plugin.

Changed February 21, 2012 08:09AM UTC by tojocky comment:5

_comment0: Sorry, \ What did you mean by: "You should file a bug against that validation plugin."? \ My proposed patch work... but I'm not sure this is the correct patch. \ Awaiting for feedback. \ 1329811844758907

Sorry,

What did you mean by: "You should file a bug against that validation plugin."?

My proposed patch work... but I'm not sure this is the correct patch.

Awaiting for feedback.

I have no permission to attach any file here.

Changed February 21, 2012 12:50PM UTC by scottgonzalez comment:6

I mean that it is never correct to fire a focus events on multiple elements. The validation plugin that you're using is implemented poorly and should be fixed.

Changed February 22, 2012 04:47PM UTC by tojocky comment:7

Could you explain more exactly where is the problem?

The plugin works as expected focusing multiple elements in one trigger call.

Changed February 23, 2012 05:06PM UTC by scottgonzalez comment:8

It's not possible to actually focus multiple elements at the same time. The plugin should work differently.

I'm not saying that there's not a bug in datepicker (that's why the ticket is still open), what I'm saying is that there's also a design bug in the validation plugin you're using.

Changed October 11, 2012 02:45PM UTC by scottgonzalez comment:9

milestone: 1.9.01.11.0

Changed June 24, 2014 11:50PM UTC by scottgonzalez comment:10

milestone: 1.11.0none