Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Loading Xml Data Island removes functions attached with AttachEvent [Thread Next] Re: Loading Xml Data Island removes functions attached with AttachEventTo: NULL Date: 6/4/2007 11:45:00 AM
Sorry for the delayed response, I am very busy with all these quirks ;-)
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).
"Joe Fawcett" <joefawcett@n...> wrote in message
news:eq9J$sBpHHA.5092@T......
> "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 | |||
|
