Board index » delphi » How to Simulate a HTML button click?

How to Simulate a HTML button click?

Is there any way of simulating a button click on a HTML form, without the
form name being specifically named?
 

Re:How to Simulate a HTML button click?


{*word*104}zen,

Can you provide more info? Are you writing script for a browser or an
application  that will do a POST? You imply that you are able to do this
when you specify the name of the form...Please provide a sample of what you
are trying.

Kim

Quote
"{*word*104}zen" <{*word*104}...@indetech.net> wrote in message

news:3b3094b6$1_1@dnews...
Quote
> Is there any way of simulating a button click on a HTML form, without the
> form name being specifically named?

Re:How to Simulate a HTML button click?


Yes there is

<html>
<head>
<script>
 function verder() {
 document.myform.submit();

Quote
}

</script>
</head>
<body onload=javascript:verder()>
<form action="http://Your adres comes here" method="post" name="myform">
    <input type="hidden" name="fieldone" value="field1">
   <input type="hidden" name="fieldtwo" value="field2">
</form>
</body>
</html>
"{*word*104}zen" <{*word*104}...@indetech.net> schreef in bericht
news:3b3094b6$1_1@dnews...
Quote
> Is there any way of simulating a button click on a HTML form, without the
> form name being specifically named?

Re:How to Simulate a HTML button click?


{*word*104}zen,

Thanks for the additional info below.I think "write a couple of values to
the text fields then simulate a button click" translates to "Perform a POST
with name/value fields set."

Unless the server explicity checks for form name, it doesn't matter whether
the form has a name. this URL echos the
parameters it receives. The parameters arrive regardless of the formname:

    www.kimberry.com/cgi-bin/echo.cgi

This URL returns more detail:

<FORM METHOD="POST" NAME="MyForm"
                       ACTION="http://www.susx.ac.uk/bin/echo.pl">
<input type=text name=myparam value="post this text">
<input type=submit>
</form>

Do you plan to use Indy components? If so, start with HTTPClient. You can
write code that will send the same request message to the server as a
browser will send when you press the submit button.

It seems you want to:

1. Do a GET of a page that has a form on it
2. Parse the field information out of the HTML page
3. Construct a POST message using that information, including the URL to
post to
4. Perform the POST.

It could be done. How about choosing a URL to use for development so we have
some common ground?

(You may cc me on your posts.)

Kim
k...@prestwood.com

Quote
"{*word*104}zen" <{*word*104}...@indetech.net> wrote in message

news:3b3094b6$1_1@dnews...
Quote
>I am trying to develop an application that will open up a page on the
>internet with a HTML form, write a couple of values to the text fields and
>then simulate a button click.

>As I understand, this could be possible if the form was named specifically,
>but is there anyway to do this instead with the focus of the last field
that
>was written to?

>This is gonna be like a search engine submitter program, but instead of
>posting the data I want to simulate actually calling up the submit page and
>then filling out the fields then clicking the submit button.

>So is this possible? If so could anyone give me some example of how to do
>this?

Other Threads