How to Fill out a web form?

Posted on 2004-10-28
Last Modified: 2010-04-17
1. I have a simple app that reads the fields I need from an access database into textboxes on my form.
2. I have a standard asp web form (on a secure site that requires a login) with all the form fields on it.

How can I fill out the form?
I was thinking that a simple copy button next to each textbox on my application would help but then I have to click back and forth 50 times to fill out one form.
Is there an easy way that I can put code under one button on my little app and send the data over to fill out the entire webform at once?

Thanks for any ideas, suggestions or code :)
Question by:Matrix1000
    LVL 2

    Expert Comment

    This is how I used to do it in ASP

    Assign the value to a variable

    Option Explicit
    dim strConn_rr, oRs, strOutPut, adt

    adt = month(date) & "/" & day(date) & "/" & year(date)

    Then use it in the form

    <input type="text" name="adate" VALUE="<%=adt%>" size="20"></p>

    You could assign a variable the value of a field from your select statement

     oRs.Open "SELECT rdate FROM repreq WHERE rdate BETWEEN '" & sdate & "' AND '" & edate & "' and cdate is null;",  _
              strConn_rr, adOpenForwardOnly, adLockReadOnly, adCmdText
        If not oRs.EOF Then
    adt = oRs("rdate")

    then use it in the form the same way

    <input type="text" name="adate" VALUE="<%=adt%>" size="20"></p>

    I like using ASP.NET better than ASP.

    in the page_load event

            Dim rdrRepReq As SqlClient.SqlDataReader
            SqlRRComm.CommandText = strLoad
            rdrRepReq = SqlRRComm.ExecuteReader(CommandBehavior.CloseConnection)

            If rdrRepReq.Read Then
                intrrnum = rdrRepReq.GetValue(0)  <=======================

    Hope this helps
    LVL 2

    Expert Comment

    oops, wrong line of code

    txtName.Text = rdrRepReq.GetValue(3)

    txtName = a textbox on your form
    LVL 1

    Author Comment

    But I dont have control of the asp is at a credit company. I just have customer data in my database that I want to use to auto fill out that form.
    LVL 2

    Accepted Solution

    sorry, misunderstood your request
    LVL 3

    Expert Comment

    the credit card company will provide you with another interface for checking credit card information,
    so you don't have to use the web page that is made for manual entering. ask them for that.
    i.e. instead of hacking to simulate manual entry, you can use B2B solution, probably with XML as
    exchange format.
    if this approach fails, there are still ways, but check that first.

    LVL 1

    Author Comment

    Thanks I checked with the company ( but they do not offer any service like that at this time thats why I'm having to do it the hard way.
    LVL 3

    Expert Comment

    is the purpose to check the credit card information and get authorization code?
    you're entering usual credit card info and getting what response?
    how long dies it take for response to arrive?

    LVL 1

    Author Comment

    The purpose is so that I don't have to enter in the same data twice.
    ie: I enter in the customer information into the database, then I have to navigate to the webform at and re-type it again just to get the customer info into the web form so that I can submit it via the Submit button on the webform itself.

    I want a way to auto load as much info as I can into the form to save some time. I'm using the same form over and over on a daily basis....
    I have some code that I think might work but I don't have vb6..only

     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        End Sub

        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If WebBrowser1.Busy Then
                MsgBox("PAGE IS STILL LOADING...PLEASES WAIT")
                Exit Sub
                WebBrowser1.Document.all("app_first_name").value = "MY FIRST NAME"
                WebBrowser1.Document.all("app_last_name").value = "LAST NAME"
                fill out other info here

                'submit the form by clicking the submit button on the webform itself
            End If
        End Sub
    **************END CODE*******************
    LVL 3

    Assisted Solution

    - check if provides such access to the document object model (DOM)
    of the webbrowser (IE).
    - check if you can create an instance of the web browser directly
    from vb, then let it load the page, then enter information using DOM.
    if this works, it would be the simplest way. the above code is a good example
    for how to access webbrowsers data.

    I don't know the differences between vb and vb6.

    LVL 3

    Assisted Solution

    Hi there.

    i think there is a way to get around this, by writing a program that would perform the following:

    1. post the login request
    2. the credit company should post you back w/ the required page
    3. post the form with "POST" form to the company
    4. continue doing 3 until all data are posted

    another way is to use naspunit.. refer to this example for more info (;

    LVL 1

    Assisted Solution

    I agree with harry_hendrata. (his first suggestion. Can't comment on the 2nd)

    IMHO the correct approach to this problem is to not use the web browser as an intermediary,
    but to directly issue the inital HTTP GET and subsequeny POSTs.  There are many libraries available
    for doing this from VB.NET.  The fact that the remote side is ASP.NET is of little consequence, and
    having to parse the DOM to find the fields (within the browser) makes little sense.

    It may require tracing through the remote website a bit to figure out what is expected (such as cookies),
    but it is the more elegant solution.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    matchUp  challenge 6 36
    Order table with macro 3 66
    countAbc challenge 9 35
    mapAB Challlenge 35 50
    This article will show, step by step, how to integrate R code into a R Sweave document
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now