Skip to main content

Search and Top Navigation

#8465 closed bug (notabug)

Opened July 27, 2012 05:04PM UTC

Closed August 15, 2012 08:32AM UTC

DatePicker IE9 with Validator: Script 5007

Reported by: thehalcyon1234 Owned by: thehalcyon1234
Priority: minor Milestone: 1.9.0
Component: ui.datepicker Version: 1.8.22
Keywords: Cc:
Blocked by: Blocking:


Create a textbox with a datepicker and an validator targeting that textbox.

Click the textbox to open the datepicker. Click a date.

Expect: Datepicker to close, populate the textbox.

What happens: Textbox populates, datepicker does not close. Script error is thrown.

Repro: I've put up a test site that uses jquery 1.7.2, and UI 1.8.22. Visit with IE9 to reproduce the error. I've included the non-minified versions, so you can follow the stack for the error.

The only solution I've found so far is to add a blank onSelect function to the datepicker. This is a workaround at best, since it probably isn't feasible to go to every instance of datepicker in the system and add a blank onSelect.

Thanks for looking at this, I'll provide any more information I can.

Attachments (0)
Change History (7)

Changed July 27, 2012 05:07PM UTC by scottgonzalez comment:1

owner: → thehalcyon1234
status: newpending

Please provide a reduced test case that doesn't require .net.

Changed July 27, 2012 05:13PM UTC by thehalcyon1234 comment:2

status: pendingnew

Some more information:

When the event finally reaches the .net function ValidatorOnChange(event), event.srcElement is set to the TD clicked.

The element that the validator is attached to is the input:text, not the td.

Now, in an ideal world, .Net should be checking that vals (the collection of validators) is not null before trying to run them. However, in an also ideal world, the click event on the <td> should never bubble up to the function. Somehow, IE8, Firefox, etc, all keep the event from bubbling up. The example page works fine in those browsers.

Changed July 27, 2012 05:16PM UTC by thehalcyon1234 comment:3

@scott.gonzalez: I cannot provide a reduced test case, since this error ONLY occurs while interacting with .net's validators. I am certain the script error is actually a symptom, and not the cause. The cause is how the datepicker bubbles up the click event on the TD in IE9, rather than suppressing it in IE8, FF, etc.

I don't know enough about the inner workings of jqueryui to explain WHY that happens, only pointing out when it is happening.

Note however, in the test site I set up, the first input:text is just a regular input, with no validators or anything hooked up to it, just the Datepicker. That's as reduced as I can get it, but it doesn't demonstrate the error.

Changed July 27, 2012 05:20PM UTC by scottgonzalez comment:4

status: newpending

It sounds like the bug is in the validator not the datepicker. We need something reduced to look at, we can't debug something as big as the .net validation system.

Changed July 27, 2012 06:10PM UTC by thehalcyon1234 comment:5

status: pendingnew

You don't need to debug the entire .net validator system. The stack trace at the time of the error is 12 function calls deep, 11 of which are in jquery and jqueryui. The issue truly isn't with the validators BUT it is the only way I can reproduce this error. And I suspect anyone else who has information/experience will hit this ticket looking for the thrown error message (Script5007).

The question really isn't "why doesn't .Net skip validation on non-validating items". The real question is, "Why does the Datepicker, in IE9 only, trigger an event where the event target is the TD, when it works fine in other browsers".

I've provided the test page so you can at least see the stack. The error is 100% client-side, so there's no need to debug the server-side code.

It's almost certainly an IE9-being-weird bug because-- well-- every issue I've had in the past year has been an IE9 bug. I'm sure that the solution is handling that case in ui.datepicker.

What I'm trying to get at is this: datepicker should never be triggering a change event on the clicked element. It should only raise the change event on the textbox it is targetting. I'm not sure how the change event is being raised. If you replace ValidatorOnValidate(event) with SomeFunction, you'll get the same results:



if (event.srcElement.tagName == "input")


console.log("This is okay!");




console.log("OMG? WTF? I can only handle input:text! It burns it burns! Get it away from me! AHHHHH!");



Changed July 31, 2012 08:56PM UTC by scottgonzalez comment:6

status: newpending

There is no event.srcElement. It's a generated event. Can you please provide a reduced test case with your minimal SomeFunction?

Changed August 15, 2012 08:32AM UTC by trac-o-bot comment:7

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!