Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2005

Tip: Looking for answers? Try searching our database.

Capturing a Node Value Change

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Morse - 09 Nov 2005 20:09 GMT
Hi

I developing an application using InfoPath but i'm noticing that InfoPath
does not raise an event when the underlying XML is changed.

Ofcourse, I can write an event handler for each node but is there a way to
capture a "node changed event" on a more global level?  Possibly passing in
as a variable something similar to the DataDOMEvent object?

Any help on how I can capture this information would be very useful

Thanks,
Franck Dauché - 09 Nov 2005 20:46 GMT
Hi Michael,

You can catch the event at the root level:

[InfoPathEventHandler(MatchPath="/my:MyRootName",
EventType=InfoPathEventType.OnAfterChange)]
public void OnAfterChange(DataDOMEvent e)
{
   \\Your code here....
}

Hope that it helps.

Regards,

Franck Dauché

> Hi
>
[quoted text clipped - 8 lines]
>
> Thanks,
Michael Morse - 10 Nov 2005 00:28 GMT
Thanks Frank,

But can this also be done with JScript and not managed code?

> Hi Michael,
>
[quoted text clipped - 25 lines]
> >
> > Thanks,
Franck Dauché - 10 Nov 2005 00:38 GMT
Yes, you can use:

function msoxd_my_myRootName::OnAfterChange(eventObj)
{
 if (eventObj.IsUndoRedo)
 {
    return;
 }
 //Your code here
}

Hope that it helps.  If my post was useful to you, don't hesitate to rate it.

Regards,

Franck Dauché

> Thanks Frank,
>
[quoted text clipped - 29 lines]
> > >
> > > Thanks,
Michael Morse - 10 Nov 2005 00:40 GMT
Frank,

That's awesome and helps alot!.. but where is this documented?  It makes me
wonder what other events I could listen for.

Because by looking in the object browser I don't see this event

> Yes, you can use:
>
[quoted text clipped - 46 lines]
> > > >
> > > > Thanks,
Franck Dauché - 10 Nov 2005 02:14 GMT
Hi Michael,

Glad I could help....You are rigth, there is a lack of JScript snippets, but
you can find C# out there.  There you can usually figure out the JScript
equivalent...by trial and error at least.

Good luck with your developments.

Regards,

Franck M. Dauché
 

> Frank,
>
[quoted text clipped - 53 lines]
> > > > >
> > > > > Thanks,
Michael Morse - 10 Nov 2005 07:09 GMT
Franck,

Finally got your name right I see, sorry!

Hey, I 've gotten that event to fire ofcourse but how can I tell what node
cause the event.  I specifically need it's XPath.   When I try
eventObj.Source.nodeName or eventObj.Source.Site.nodeName i'm not seeing
anything to useful yet.

Is there a way I can find out which node caused the event?

> Hi Michael,
>
[quoted text clipped - 66 lines]
> > > > > >
> > > > > > Thanks,
Franck Dauché - 10 Nov 2005 17:21 GMT
Hi Michael,

You won't be able to access the full XPath from just on property.  In fact
you need to build your XPath.
From your first node: eventObj.Source, you can get the name through
nodeName.  Then you have to use node.parentNode to go back one level in your
schema and get the name of that node that you append to the previous one, all
the way back to the root.

Does it make sense?

Hope that it helps.

Regards,

Franck Dauché

> Franck,
>
[quoted text clipped - 77 lines]
> > > > > > >
> > > > > > > Thanks,
Michael Morse - 10 Nov 2005 17:32 GMT
I keep getting the value #text when I do
XDocument.UI.Alert(eventObj.Source.nodeName);

Am I doing something wrong?

> Hi Michael,
>
[quoted text clipped - 94 lines]
> > > > > > > >
> > > > > > > > Thanks,
Franck Dauché - 10 Nov 2005 19:05 GMT
Hi Michael,

I was thinking in terms of C#.  Try to use:
var node = eventObj.Parent;
XDocument.UI.Alert(node.nodeName);

Franck

> I keep getting the value #text when I do
> XDocument.UI.Alert(eventObj.Source.nodeName);
[quoted text clipped - 99 lines]
> > > > > > > > >
> > > > > > > > > Thanks,
Michael Morse - 10 Nov 2005 19:32 GMT
JJJJJJJJJJAAAAAAAAAAACCCCCCCCCCCCCCKKKKKKKKKK   POT!

> Hi Michael,
>
[quoted text clipped - 107 lines]
> > > > > > > > > >
> > > > > > > > > > Thanks,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.