Chris Sheffield wrote:
So my main question is, can Rev send data to a web form like this in such a way that whatever fields we specify will be populated when the browser/form opens? Not sure if something like this is even possible. I haven't done enough web development to know. Is some special JavaScript required to accomplish this? In thinking this through a little more, if we have a web form that's already set up to send an email, can't I take advantage of that in Rev by creating my own form and then sending the data straight to the cgi behind the form? Once again, I haven't done much web dev, so I may not even know what I'm talking about. :-)

If anyone can help or can offer any other suggestions for how to
accomplish something similar, it'd be much appreciated.


If I've understood your request correctly, you really want a Rev stack to
collect some information from the user, and have it arrive at your server in
the form of an email.  There's a simple way to get what you want, I think.

Using the SMTP libraries should make this possible, but has some issues, in
particular your rev stack then needs to know the address of a mail server it
can use from within the user's network to send email.  But if you have a web
form on your server that's successfully sending email where you want it,
there's no need to open a user's browser to view it.  Instead, Rev can
effectively be that web form.

(Apologies if what follows is teaching my granny to suck eggs.) If you look at
the source of the web page, it will contain a "form" element with an action
and a method.  The action is the address of a server-side resource (a script
etc) which receives the values entered into the form and processes it, in this
case by sending an email.  The method is either POST or GET.  If it's GET,
then the resource expects the values in the URL string, eg if I fill in this
simple form

        <form method="GET" action="formmail.cgi">
                <input name="first" type="text">
                <input name="last" type="text">
                <input type="submit" />
        </form>

my browser will next fetch a URL like this:
  ...../formmail.cgi?first=Ben&last=Rubinstein

(the first part of the URL being constructed based on the URL of the page
holding the form, adjusted by the 'action' of the form.)

Lecture over; the point is that executing

        put "...../formmail.cgi?first=Ben&last=Rubinstein" into tURL
        get URL tURL

or perhaps more likely
        put "...../formmail.cgi" into tScriptURL
        put tScriptURL \
            & "?first=" & tFirstName \
            & "&last=" & tLastName \
            into tURL
        get URL tURL



in your Rev stack will have exactly* the same effect on the 'formmail.cgi'
resource as the user entering those details into their browser.  At this point
Rev is acting like a browser, making a request of the web server.  So no need
to open an actual browser.

If the form uses the POST method instead, then it's only slightly more
complicated.  Instead of get URL, you need to use the "post" command, which
will look something more like this:

        put libURLformData("first", tFirstName, "last", tLastName) into tData
        post tData to tScriptURL

There will be a few complications along the way; you should read the
(splending new in 3.0) docs, check out functions like URLencode, and above
all, test.  But either way, given that you have the web form already, this is
probably the simplest route to achieve what you want.

HTH,

- Ben


*pedants please leave now



_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to