Note that there are some explanatory texts on larger screens.

plurals
  1. POProgrammatically triggering events in Javascript for IE using jQuery
    primarykey
    data
    text
    <p>When an Event is triggered by a user in IE, it is set to the <code>window.event</code> object. The only way to see what triggered the event is by accessing the <code>window.event</code> object (as far as I know)</p> <p>This causes a problem in ASP.NET validators if an event is triggered programmatically, like when triggering an event through jQuery. In this case, the <code>window.event</code> object stores the last user-triggered event.</p> <p>When the <code>onchange</code> event is fired programmatically for a text box that has an ASP.NET validator attached to it, the validation breaks because it is looking at the element that fired last event, which is not the element the validator is for.</p> <p>Does anyone know a way around this? It seems like a problem that is solvable, but from looking online, most people just find ways to ignore the problem instead of solving it.</p> <hr> <p><strong>To explain what I'm doing specifically:</strong><br> I'm using a jQuery time picker plugin on a text box that also has 2 ASP.NET validators associated with it. When the time is changed, I'm using an update panel to post back to the server to do some things dynamically, so I need the onchange event to fire in order to trigger the postback for that text box.</p> <p>The jQuery time picker operates by creating a hidden unordered list that is made visible when the text box is clicked. When one of the list items is clicked, the "change" event is fired programmatically for the text box through jQuery's <code>change()</code> method.</p> <p>Because the trigger for the event was a list item, IE sees the <em>list item</em> as the source of the event, not the text box, like it should.</p> <p>I'm not too concerned with this ASP.NET validator working as soon as the text box is changed, I just need the "<code>change</code>" event to be processed so my postback event is called for the text box. The problem is that the validator throws an exception in IE which stops any event from being triggered.</p> <p>Firefox (and I assume other browsers) don't have this issue. Only IE due to the different event model. Has anyone encountered this and seen how to fix it?</p> <hr> <p>I've found this problem reported several other places, but they offer no solutions: </p> <ul> <li><a href="http://groups.google.com/group/jquery-en/browse_thread/thread/a8902f2774edc05a/d119026f561ca528?lnk=raot" rel="noreferrer">jQuery's forum, with the jQuery UI Datepicker and an ASP.NET Validator</a></li> <li><a href="http://forums.asp.net/t/1326208.aspx" rel="noreferrer">ASP.NET forums, bug with ValidatorOnChange() function</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload