Attaching Events to Document Elements

Add-in Express™ Support Service
That's what is more important than anything else

Attaching Events to Document Elements
 
jaylaforte




Posts: 4
Joined: 2010-04-13
Hello again!

In my project, I am trying to capture data entered into forms in a webpage. I have used the "OnDeactivate" event from AdxiehtmlDocEvents1 and this is working okay but giving me extra events I'm not interested in when the page is loading.
I attempted to use the "OnChange" event but this is never fired for me at a Document level and I just learned that the "OnChange" events don't bubble up to the Document from the individual elements.

How can I go about attaching to the "OnChange" event for input elements in my Document? I've tried iterating through the Document looking for objects of type input (using getElementsByTagName("input")) but have been unable to attach an event when I get the input objects...

Thanks for any help you can provide!

-Jason
Posted 14 Apr, 2010 15:34:30 Top
Sergey Grischenko


Add-in Express team


Posts: 7205
Joined: 2004-07-05
Hi Jason.

To attach to all input elements of the active document you need to set the SupportedEvents property of the ADXIEHTMLDocEvents component to an appropriate value.
Posted 15 Apr, 2010 10:25:38 Top
jaylaforte




Posts: 4
Joined: 2010-04-13
Hi Sergey,

Thanks for the reply! I'm confused with what you mean here. I created my BHO project following the ADXIE documentation. I right-clicked on the IEModule.vb design view file and chose "Add HTML Events." I then clicked on the "AdxiehtmlDocEvents1" component and set an event handler for the "OnChange" event. Is this what you mean?

If it is - the problem I'm having is that the OnChange events don't bubble fr om the elements to the document and my event handler is never triggered.

I tested my event handler by attaching it to the OnClick event and had success so I know my handler code works. The problem seems to be wh ere I'm attempting to attach to.

My goal is to simply to capture data input into forms which I assumed using OnChange would be the most effective.

Thanks for your help!
-Jason
Posted 15 Apr, 2010 12:24:58 Top
Sergey Grischenko


Add-in Express team


Posts: 7205
Joined: 2004-07-05
Hi Jason.

Did you open the editor of the SupportedEvents property?
If the property is set to 'Document', you can connect to the document events only.
Posted 16 Apr, 2010 09:40:35 Top