Click to See Complete Forum and Search --> : How can I catch form submission events with a C# BHO?


RileyMPk
January 4th, 2005, 09:33 AM
Hello. I'm programming a browser helper object that modifies HTML elements on a web page. It first grabs the current HTML document as an IHTMLDocument2 (doc), and then grabs the first form element via:

IHTMLFormElement form = (IHTMLFormElement) doc.forms.item(0,0);

From there I am able to find individual members of the form and modify their values. However, I would also like to call a function when the user clicks on the form "submit" button. I have tried using the IHTMLFormElement:: onsubmit() method with no success; does anyone know how to catch it as an event and signal a function? Or is it only for modifying the HTML onsubmit property, and do I need to modify the form button code itself in order to signal within C#?

Thanks very much!

Regards,
Mike Smith

sharonsalmon
May 4th, 2008, 12:21 AM
I am developing Automatic Login & Password Management Toolbar and
I bumped into the same problem , so I managed to solve it and posted article about it.
the article is at : http://www.codeproject.com/KB/dotnet/NetHtmlEventHandler.aspx
also you can get the sources at : http://www.logonce.com/code_samples/HtmlEventProxy

Enjoy :
Sharon Salmon
http://www.logonce.com