Technology Questions

Go Back   Technology Questions > Software Questions > Internet > Internet Explorer

Internet Explorer Discuss IE7 or any other IE version.

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 06-21-2007, 03:40 AM
GMG
Newsgroup Contributor
 
Posts: n/a
Loading Xml Data Island removes functions attached with AttachEvent

No one was able to answer this. So there it goes:

When explicitly setting the event onafterupdate, to a particular function,
like so:

<input datafld="Brand_Code" type="text" size="10" maxlength="10"
onafterupdate="myFunction()" />

the event remains intact after reloading the XML (
xmldataisland.loadXML(...) ). myFunction() is fired after amending the
Brand_Code value. BUT, if myFunction() is attached like so:

<input id="Brand_Code" datafld="Brand_Code" type="text" size="10"
maxlength="10" />

<script language="javascript">
Brand_Code.attachEvent( "onafterupdate", myFunction );
</script>

The event is empty after reloading the XML and myFunction() is never fired.

My workaround is to reattach the events after each reload, but I have
encountered what seems to be a timing issue which I have worked around using
setTimeout. It is all very ugly.

Has anyone got a better solution ?
I am only interested in solutions that dynamically will attach events once
and for all no matter how many times I reload the XML. Or if you are a Guru
you may have an answer to get around the timing issue elegantly; note that
the XML Data Island is synchronous (.async=false) and I have reattached on
all the documented XML object events (ondataavailable, ondatasetchanged,
ondatasetcomplete, onreadystatechange, onrowenter) without success; the only
thing that worked was to attach the event after half a second.

P.S.: I am using IE 6.0 SP1 and will need to run on both IE6 and IE7

A question that was asked in an attempt to get to the bottom of this was:

QUESTION:
Can you attach permanently via:
Brand_Code.onafterupdate = myFunction;
or does that disappear after firing once?

ANSWER:
In response to your question (I just setup a test to confirm this), coding
Brand_Code.onafterupdate = myFunction;
disappears as well once I have refreshed the dataset ( loadXML(...) ).
It continues to work as long as the dataset is not refreshed. The symptom is
the same as when using attachEvent.
The only thing that works is hardcoding in the HTML:

<input datafld="Brand_Code" type="text" size="10" maxlength="10"
onafterupdate="myFunction()" />

This could be by design, but if it is why do none of the events on the XML
dataisland enable me to reattach the event?
If it is by design, it is very poor design (unless I have missed something).




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 06-21-2007, 03:40 AM
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PC Technician - Long Island, NY TPC Tablet PC Jobs 0 03-04-2008 09:40 AM
Technician - Long Island TPC Tablet PC Jobs 0 01-08-2008 07:10 AM
Windows XP freezes when USB mouse/keyboard are attached but not when a serial set is attached John Dalberg Windows XP 2 06-16-2007 01:40 PM
Saving / Loading Ink Data njhartley@gmail.com Tablet PC Developers 3 05-06-2007 07:31 AM
HP and Batelco unwire the island LPH Tablet PC - In The News 0 04-20-2004 05:18 AM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 08:20 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0