CGI with stacks question
J. Landman Gay
jacque at hyperactivesw.com
Sun Aug 20 15:29:36 CDT 2006
Shari wrote:
> Can you do this:
>
> In a standard Metacard stack in the CGI folder, have a handler, say:
>
> on helloFriend
> # blah blach
> ask "What's your name?"
No, because that would require putting up the answer dialog, and there
are no stacks available in a web browser. What you have to do is return
the html that comprises a web form, and then have that form post the
results back to a cgi on your site. This probably isn't the easiest
thing to start with for your first cgi.
> In other words, Metacard can do a lot. But can the CGI version do the
> same? Obviously a web page cannot be a program, so surely there are
> some sort of limitations?
You are limited to what a browser can display, basically. You can return
HTML or text. There is no MC GUI in the browser -- no stacks, no
resources, no buttons, etc., though your cgi can read info from stacks
on the server (see the address book example in the tutorial.) Once a
script returns whatever it is doing, the session ends and the engine
shuts down. For now you can think of your cgi as just an HTML generator,
and each cgi request as a new engine session. Globals and other variable
values are not retained between cgi requests unless you specifically
write them to files on disk so you can read them back in again (see the
visitor counter example.)
If the returned HTML is a form, then it can create browser buttons and
text areas, etc. like any standard web form. The user input would be
sent back to your server as an independent request (that is, a separate
session). You'd need to keep track of cookies or use some other way to
identify whose browser is sending back the info, because the original
cgi script that created the form would have terminated by then, and the
user input would be sent as a new request.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the metacard
mailing list