Can ZPT form call a url?
On our website we have a form where by a person can subscribe to our announcements list. It is the standard mailman form. We would like to expand on that form such that a user can enter their email address and zip code which we would log to our database and then call the url to subscribe the person in the mailman list. Is there a way to do this? Thanks! Jamie
--On Montag, 23. Mai 2005 22:36 Uhr -0400 James O'Keefe <jokeefe@jamesokeefe.org> wrote:
On our website we have a form where by a person can subscribe to our announcements list. It is the standard mailman form.
We would like to expand on that form such that a user can enter their email address and zip code which we would log to our database and then call the url to subscribe the person in the mailman list.
You definitely want to do this on the server side when submitting the form. Since you can call scripts a from action you can call any known method in Python to trigger an HTTP request (-> Python's urllib module). -aj
James O'Keefe wrote at 2005-5-23 22:36 -0400:
We would like to expand on that form such that a user can enter their email address and zip code which we would log to our database and then call the url to subscribe the person in the mailman list.
The easiest way it to perform a redirect. Unfortunately, HTTP allows automatic redirects only for "GET" requests. But, if you can live with "GET", then it is very easy. -- Dieter
The easiest way it to perform a redirect.
Unfortunately, HTTP allows automatic redirects only for "GET" requests. But, if you can live with "GET", then it is very easy.
Fortunately, most web browsers are lax and let you do this. Safari is not, but the warnings are a bit obscure to most users, as a 302 response technically means to repost the data to a new URL - hence Safari's 'do you want to resend this data' question. A 303 response should be used to redirect a POST request. The user is still supposed to be asked if they want to follow the redirect, but I bet most browsers won't, as the specs are ambiguous. -- Phillip Hutchings http://www.sitharus.com/ sitharus@gmail.com / sitharus@sitharus.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Phillip Hutchings wrote:
The easiest way it to perform a redirect.
Unfortunately, HTTP allows automatic redirects only for "GET" requests. But, if you can live with "GET", then it is very easy.
Fortunately, most web browsers are lax and let you do this. Safari is not, but the warnings are a bit obscure to most users, as a 302 response technically means to repost the data to a new URL - hence Safari's 'do you want to resend this data' question.
A 303 response should be used to redirect a POST request. The user is still supposed to be asked if they want to follow the redirect, but I bet most browsers won't, as the specs are ambiguous.
HTTP 1.1 isn't ambiguous about 303: it defines that response code for exactly that usecase[1]: 10.3.4 303 See Other The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable. The different URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s). Note: Many pre-HTTP/1.1 user agents do not understand the 303 status. When interoperability with such clients is a concern, the 302 status code may be used instead, since most user agents react to a 302 response as described here for 303. [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Tres. - -- =================================================================== Tres Seaver tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFClGQV+gerLs4ltQ4RAoV5AJ9zhh7KQlMCu7CyAqPC/tX0BGbu5gCfdpZD gLvgYuldYpCuugugzYx99Kg= =Hw6n -----END PGP SIGNATURE-----
participants (5)
-
Andreas Jung -
Dieter Maurer -
James O'Keefe -
Phillip Hutchings -
Tres Seaver