Auto fill in and submit form in normal web page

Ming Cheung 421 Reputation points
2021-11-17T04:35:31.25+00:00

i want to automatic form submittion in normal web page,
but no idea how to start, searched but no article about it.
could anyone help some instruction? thank you

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,246 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,203 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lan Huang-MSFT 25,386 Reputation points Microsoft Vendor
    2021-11-17T07:10:21.29+00:00

    Hi @Ming Cheung ,
    I think you can use JavaScript to do this, using the javascript onload method. Just add the following JavaScript code on your form page.

    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head runat="server">  
        <title></title>  
            <script type="text/javascript">  
               window.onl oad = function () {  
                document.getElementById('<%= commentTextBox.ClientID %>').value = 'whatever value';  
                var form = document.getElementById("form1");  
                form.submit();  
              }  
        </script>  
    
    </head>  
    <body>  
        <form id="form1" runat="server">  
            <div>  
               <asp:TextBox id="commentTextBox" runat="server"></asp:TextBox>  
            </div>  
        </form>  
    </body>  
    </html>  
              
                          
    

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Ming Cheung 421 Reputation points
    2021-12-20T09:22:35.26+00:00

    Please cancel the question

    0 comments No comments