Auto fill in and submit form in normal web page

Ming Cheung 426 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

Developer technologies ASP.NET Other
Developer technologies C#
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lan Huang-MSFT 30,186 Reputation points Microsoft External Staff
    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 426 Reputation points
    2021-12-20T09:22:35.26+00:00

    Please cancel the question

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.