Solved

delphi webbroker: passing multiple parameters and using response.contents...help!

Posted on 2002-04-02
2
533 Views
Last Modified: 2010-04-04
Hi there,

Hopefully this is one of those questions you say "cool easy points".

I'm using Delphi webbroker for the first time creating dynamic web pages. I've got a cgi program running on the server verifying login and p/w info from "loginpage.htm" (the FORM ACTION on "checker.exe" runs this and is the default action of this .exe). A successful login brings up a page with a listbox with some values in it. I want to use those values selected. I.e the user chooses "apple" in the listbox, clicks "buy apple" and that runs another action of the same executable. It would be easy if i could have two submit buttons (i've used one for logging in of course).

I've used request.contentfields to get the first set of values (eg login and p/w) but when i use it to get the listbox values i can't get anything. How do i do it? Do i need to create a seperate .exe? Can i specify if the request was from page "blah" do this...?

Cheers

Neil
0
Comment
Question by:NeilLewis
2 Comments
 
LVL 7

Accepted Solution

by:
Motaz earned 200 total points
Comment Utility
Your solution is to use Multiple actions, for example you can have two WebActions:
waLogin
waBuy
in waLogin you can set path as /login, and /buy in waBuy action.
in Login form make the action = "checker.exe/login" and in the form that contains the list box you can set the action in HTML: action="checker.exe/buy", then you can have only one CGI application serves unlimited number of actions.

I'll post here this topic from my EBook Delphi Programming Guide (Web development chapter) www.geocities.com/motaz1:

----------------------

In real web server programming you need to write multiple actions for different requests. For instance if you need to write a telephone directory which contains search and subscription forms you didn't need to write two web applications: one for search and one for subscription such as:

http://MyServer/WebSer/search.exe

http://MyServer/WebSer/sub.exe

Instead you can write only one web application and create two web item actions, the first one can be called waSearch and the other waSub. waSearch contains /search in it's PathInfo property and waSub contains /sub in it's PathInfo. PathInfo property makes your web server respond to your request according to passed path, for example if you pass below URL to your application:


http://MyServer/WebSer/phone.exe/search

The first action will be executed (waSearch), and if you pass below URL:

http://MyServer/WebSer/phone.exe/sub

The second action will be executed to respond to your request.

You can combine PathInfo with parameters such as:

http://MyServer/WebSer/phone.exe/search?name=Motaz

Returned value of Query property of Request will be: "name=Motaz"

By this method you can write only one web server application to respond to multiple HMTL forms and queries.

There is a complete code of Telephone directory application with this article. Copy this sample to a directory and make a WWW Alias for it. Make sure that read and execute permission is checked for that Alias.

There is a third action in this example called waAll which returns all records. To call this action write:

http://MyServer/WebSer/phone.exe/all


------------------------
Also I have an associated example with this topic if you want you can tell me your E-Mail to send it to u.
Motaz
0
 

Author Comment

by:NeilLewis
Comment Utility
Thanks heaps, that should do the trick.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

9 Experts available now in Live!

Get 1:1 Help Now