: : : : : i'm going to be crazy. please help me...
: : : : : i want to create an application running on the net. it has a form and a combobox on the form. when the page opened, the combobox gets the filenames from the service computer; and when user write on the combobox, application creates an another text file on the service computer.
: : : : : what are the procedures that i had to follow to create an application running on internet such this. (sorry for bad english; please help me...)
: : : : :
: : : : IMHO the best way to tackle this is to write an ISAPI dll and run that within the confines of a webserver. For this you'll need to klow a little HTML and their forms. And of course you need to have access to a webserver, which allows you to run ISAPI libraries. If you want to test it on your own computer, I suggest that you use the Apache webserver (free downloadable from http://httpd.apache.org/).
This method uses mainly the TPageProducer component, and the TWebModule datamodule. Most of the code is already in those two objects. Delphi ships a demo of an ISAPI dll called iserver.dll (demo/webserv).
: : : : Another method is to use ActiveX forms, which are loaded into the html code. Some users might not be able to access this, because they have turned off the ActiveX support or might run a browser, which doesn't support ActiveX. Also this again requires a webbrowser, which allows you to run CGI scripts. I don't know much about this method, because I dislike ActiveX in general, so I never took the time to learn it.
: : : :
: : :
: : : i was working on active forms until now. thank you for this new way. now, i downloaded apache. should i use TPageProducer on a normal form; or on the web module? thanks again...
: : i tried tpageproducer. with this i can show a database table on internet. but my main problem is to make possible entering data to this table by an internet user. when i put some controls or link on this page to write on my database table( for example, when user click on radiobutton1 database must save it as 1 or 2 on radiobutton2) , remote machine fails to reach the file. which procedure i pass?
: : :
: You need to create a "Web Server Application" (dialog after File|New). This will create a TWebApplication with a single TWebModule. Onto the webmodule you place the database access components and page producing components (such as TPageProducer, and perhaps TQueryTableProducer, etc). The HTML code itself is created by the TPageProducer using the OnHTMLTag() event and a template page. Remember the HTML pages become the forms of the project. Things like buttons, comboboxes, etc. all need to be code in HTML instead of in Delphi.
: Once you have the HTML code generated by the TPageProducer, you can start on exposing them to the user. This is done using the Actions. Through their OnAction()'s, you can determine what the user is doing, and what he wants to be done by the application. Here is a small HTML page, which asks the user for his name:
: <title>Type your name</title>
: Type your name
: <form action="http://YourIsapiDLL.dll/SetUsername" method="post">
: <input type="Name" name="UserName" size="40" maxlength="80" value="">
: <input type="submit" value="Sumbit"><input type="reset" value="Clear">
: And this is the code for the action to get the Username into the application:
: procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
: Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
: UserName := Request.GetFieldByName('UserName');
: // Username is a global variable
: Response.Content := '<html><body>Welcome, '+UserName+'</body></html>';
: The PathInfo of WebActionItem1 is "SetUserName", and its producer is left empty for this example.
: As you can see there are no forms or dialog boxes, which tells the user what's going on. All the communication is done using HTML. Here is a small example of how to use the TPageProducer.OnHTMLTag() event:
: First the HTML code:
: <title>Updated Record Stats</title>
: <#UserName> has updated <#RecordNum> records.
: And the Delphi code:
: procedure TWebModule1.PageProducer1HTMLTag(Sender: TObject; Tag: TTag;
: const TagString: String; TagParams: TStrings; var ReplaceText: String);
: if TagString = 'UserName' then
: ReplaceText := UserName
: else if TagString = 'RecordNum' then
: ReplaceText := IntToStr(UpdatedRecordNum);
: You then use a TWebActionItem to make sure the user can surf to this page, by setting its Producer and PathInfo properties. You don't need to write an OnAction() in this case, because it will automatically send the Pageproducer's Content to the user.
: On a final note: there is a memory leak in Delphi, which is important for web programmers. See this article in the Delphi Magazine http://www.thedelphimagazine.com/samples/1328/1328.htm
for more info.
thanks a thousand lots!!! You saved my life...