Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Loading Xml Data Island removes functions attached with AttachEvent >Thread Next - Re: Loading Xml Data Island removes functions attached with AttachEvent Re: Loading Xml Data Island removes functions attached with AttachEventTo: NULL Date: 6/1/2007 8:06:00 AM "GMG" <nospam@nospam> wrote in message news:%23R0ohjnoHHA.2452@T...... > 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 > > So I take it that you are unable to use the first method, the onafterupdate attribute? Can you attach permanently via: Brand_Code.onafterupdate = myFunction; or does that disappear after firing once? -- Joe Fawcett (MVP - XML) http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
