Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7869593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:22:24+00:00 2026-06-03T01:22:24+00:00

I am trying to auto submit form using webbrowser control. I am using the

  • 0

I am trying to auto submit form using webbrowser control. I am using the following code to submit”

currentElement.InvokeMember("submit");

Now this methods works fine. But sometimes a form may have some javascript function that is called on button click at the time of submission. So let’s say if a form has some button image called “Submit” and when a user presses it, a javascript function somefunction() is called and then form is submitted.

Problem is when I use the above method InvokeMember then it only submits the form and doesn’t execute associated scripts (in this case somefunction()) and I have to manually write code

webBrowser1.Document.InvokeScript("somefunction");

But this requires that I know before hand if there is some function. Is there any way I submit form and it will automatically run all associated javascript?

And I don’t know button name or ID either which is clicked by user to submit form. Because in some cases it may not even have ID or name for e.g.

<span class="btn" onclick="somefunction()">
<img style="cursor:pointer" title="Submit" alt="Submit" src="http://stackoverflow.com/imagesbutton.png?2012">
<div id="s" style=""></div>
</span>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:22:25+00:00Added an answer on June 3, 2026 at 1:22 am

    It’s been a while since I have messed around with the WebBrowser control, but I used to make it jump through hoops for me. I’ve come across this issue in the past.

    http://www.codeproject.com/Tips/60924/Using-WebBrowser-Document-InvokeScript-to-mess-aro

    When you get a Form object, take the string out of the OnSubmit and run this to execute it before submitting the form:

    object[] codeString = {"myObject.setVariable(0);"};
    webBrowser1.Document.InvokeScript("eval",codeString);
    

    Works like a charm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having two problems. First: Trying to submit this form using jquery. When
I'm trying to add the functionality to this dynamic order form that will auto
I am trying to submit a form using Ajax.Updater and have the result of
I'm trying to make an auto login script and I'm stuck on the submit
i receive the following error when trying to implement auto-complete based on edismax type.
I am trying to set up an auto-complete search form with jQuery. I would
i have my auto-generated linq to sql classes, and i extend this class using
I'm trying to make an auto-login using Greasemonkey. Can anyone help me? Relevant HTML
I am trying to pass form name dynamically. But this script is showing an
So, I've been trying to get this form to work (css and javascript), but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.