Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Loading Xml Data Island removes functions attached with AttachEvent

From: "GMG" <nospam@------>
To: 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
>
>




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent