[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Placing text into browser input box

I have a simple html submit form with a text input box.  How do I place text into it on the browser from Delphi?

Not using (TWebBrowser)
0
Grant Fullen
Asked:
Grant Fullen
  • 3
  • 3
  • 2
1 Solution
 
DropZoneCommented:
What are you using?  Delphi.NET, CGI, etc?

    -dZ.
0
 
Grant FullenAuthor Commented:
Just regular delphi.

I have Internet Explorer open with a simple html submit form with one edit and a submit button.  I want to place text into that edit from delphi.
0
 
MerijnBSr. Software EngineerCommented:
sounds like you also host the html page, is this true?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Grant FullenAuthor Commented:
Yup.  It's mine.
0
 
MerijnBSr. Software EngineerCommented:
in that case, make it a simple asp or php page, so you can give the contents of the box in the url itself, will save you lots of trouble :)
0
 
DropZoneCommented:
I'm having trouble understanding what you ultimately want to do.  I understand that you have a web page and you want to put values on it from a Delphi application, but is this to generate a report, or is it going to be an interactive application?

If you are making an application that will process html form data, you may want to create your own web-server application: one that receives the input and generates the output itself.  For this you could use the wonderful ICS TWSocket components from Francois Piette, in particular the HttpSrv (Http Server) component.  You can find these components at <http://www.overbyte.be/>.  TWSocket has an excellent support mailing list with many experts that can answer any questions and offer help or sample code.

If you just want to generate an html page wih static text (one that does not need to be posted back for processing, like a report), then you can just create a Delphi command-line application that will "print" as its output the html page.  This is basically what CGI applications are.

If you have Delphi 2006, you could use Delphi.NET to create an ASP.NET page which will be a lot simpler:  You can create a web page that has delphi code running "behind-the-scenes", that can process input and generate output, with a simple html template.  This is the easiest approach.

If you don't have Delphi.NET, you could also make a COM component for use in a Classic ASP page.  The COM component would do the necessary processing of your page, and then the asp page will contain html along with some script to instantiate the component and process the input and output.

You could also use WebSnap (a Delphi technology for web components) that will work pretty much as the COM approach a mentioned above.

If you have the latest Delphi For PHP, then its even easier! With that you can write Delphi code that will process a web page, generating output from your code. <http://www.codegear.com/products/delphi/php>.

You can find some information about the technologies I mentioned above, along with some tutorials, on this site: <http://www.drbob42.com/>.

It all depends on which version of Delphi you have, and what you want or need to do.  Telling us "I want to put text in the Edit from Delphi" does not offer much information, because we still don't know if you need to interact with the user in other ways or just generate a static html page.

       -dZ.
0
 
Grant FullenAuthor Commented:
MerijnB, it's a file text box for posting a file to a php script.  How would I place it in the url?
0
 
DropZoneCommented:
grantfullen,
      I'm curious to know why you accepted a solution when it seems that it didn't answer your question?  I'm just wondering since the asnwer you accepted does not tell you how to set the text from Delphi into the TextBox (which is your original question), nor explains how to put the value into the URL or how to use it (as it proposed).

If you are using Delphi to generate an HTML page, you can inject the value into the textbox like this:

     StrTextValue := 'Hello world!';
     HtmlOutput := HtmlOutput + '<input type="text" name="myTextBox" value="' + StrTextValue + '">' + #13#10;

Where HtmlOutput reprecents the buffer contianing the html output you are generating, and StrTextValue represents the value you want to set in the TextBox.

If you are using Delphi For PHP then you can do it like this:

From code:

// $myTextBox represents the name of the TextBox control
$myTextBox->Text = "Hello world!";

Or from templates:

<html>
<body>
    <form ...>
        <input type="text" name="myTextBox" value="{ $TextValue }">
    </form>
</body>
</html>

Here's some information on how to do a simple Delphi For PHP page:
http://www.qadram.com/vcl4php/wiki/index.php/Users_guide:Hello_World

     -dZ.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now