Hi all,
dev. env.: VS.Net2003/C#
I have a windows form application with web browser control. I need to
capture the onsubmit event of the forms in the document in order to get
the values and log them.
I have tried this:
1.
this.current_pa ge = this.mydoc.Docu ment as mshtml.HTMLDocu mentClass;
if (this.current_p age != null)
{
mshtml.IHTMLEle mentCollection _forms = this.current_pa ge.forms;
foreach (mshtml.IHTMLFo rmElement _form in _forms)
{
((mshtml.HTMLFo rmElementEvents 2_Event)_form). onsubmit +=
new mshtml.HTMLForm ElementEvents2_ onsubmitEventHa ndler
(MyDoc_onsubmit );
}
}
2.
<same, just diff. foreach>
foreach (mshtml.HTMLFor mElementClass _form in this.forms)
{
_form.HTMLFormE lementEvents2_E vent_onsubmit +=
new mshtml.HTMLForm ElementEvents2_ onsubmitEventHa ndler
(MyDoc_onsubmit );
.....
And there are 2 articles on codeproject.com , they do not work also.
And ... no success. There is no exceprions, everything passes, but after
that the form submition on the page is blocked, even the submit button
does not work.
I have tried to go around this and to use BeforeNavigate2 event of the
browser (it works) and to examine if there is postdata. But in that case
I'll loose forms which has GET method.
Please, any help will be highly appreciated.
Thanks
Sunny
dev. env.: VS.Net2003/C#
I have a windows form application with web browser control. I need to
capture the onsubmit event of the forms in the document in order to get
the values and log them.
I have tried this:
1.
this.current_pa ge = this.mydoc.Docu ment as mshtml.HTMLDocu mentClass;
if (this.current_p age != null)
{
mshtml.IHTMLEle mentCollection _forms = this.current_pa ge.forms;
foreach (mshtml.IHTMLFo rmElement _form in _forms)
{
((mshtml.HTMLFo rmElementEvents 2_Event)_form). onsubmit +=
new mshtml.HTMLForm ElementEvents2_ onsubmitEventHa ndler
(MyDoc_onsubmit );
}
}
2.
<same, just diff. foreach>
foreach (mshtml.HTMLFor mElementClass _form in this.forms)
{
_form.HTMLFormE lementEvents2_E vent_onsubmit +=
new mshtml.HTMLForm ElementEvents2_ onsubmitEventHa ndler
(MyDoc_onsubmit );
.....
And there are 2 articles on codeproject.com , they do not work also.
And ... no success. There is no exceprions, everything passes, but after
that the form submition on the page is blocked, even the submit button
does not work.
I have tried to go around this and to use BeforeNavigate2 event of the
browser (it works) and to examine if there is postdata. But in that case
I'll loose forms which has GET method.
Please, any help will be highly appreciated.
Thanks
Sunny
Comment