can one pass values through the 'action' property?
I'm trying to do this: <form action="get_row?row=3" method="POST"> ... <input type="submit" name="submit" value="submit"> .... </form> However, "row" does not show up in the REQUEST namespace, even though a similar syntax works in a HREF tag. Can this be done? I know I can add a hidden input tag, but it's a little messier. Thanks, Albert
Ok, I copied your scenario, and then printed out the REQUEST object. The only variable that shows up is submit, which means that Zope doesn't allow you to append querystring info in your form tag. That sucks. I've always used hidden fields, but I see that you don't particularly care for that approach. Hmmmm..... any other ideas community? Tommy Innovation: The Best Way To Predict The Future ... Is To Create It.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Albert Ting Sent: Friday, August 03, 2001 4:49 PM To: zope@zope.org Subject: [Zope] can one pass values through the 'action' property?
I'm trying to do this:
<form action="get_row?row=3" method="POST"> ... <input type="submit" name="submit" value="submit"> .... </form>
However, "row" does not show up in the REQUEST namespace, even though a similar syntax works in a HREF tag. Can this be done? I know I can add a hidden input tag, but it's a little messier.
Thanks, Albert
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
I suppose I could also do this with a session object. What's the "right" way of doing it? But still, it would be nice to have the choice of passing things through the action. Tommy Johnson writes:
From: "Tommy Johnson" <tommy@7x.com> To: "Zope List" <zope@zope.org> Subject: RE: [Zope] can one pass values through the 'action' property? Date: Fri, 3 Aug 2001 19:34:11 -0800
Ok, I copied your scenario, and then printed out the REQUEST object. The only variable that shows up is submit, which means that Zope doesn't allow you to append querystring info in your form tag. That sucks.
I've always used hidden fields, but I see that you don't particularly care for that approach. Hmmmm..... any other ideas community?
Tommy
Innovation: The Best Way To Predict The Future ... Is To Create It.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Albert Ting Sent: Friday, August 03, 2001 4:49 PM To: zope@zope.org Subject: [Zope] can one pass values through the 'action' property?
I'm trying to do this:
<form action="get_row?row=3" method="POST"> ... <input type="submit" name="submit" value="submit"> .... </form>
However, "row" does not show up in the REQUEST namespace, even though a similar syntax works in a HREF tag. Can this be done? I know I can add a hidden input tag, but it's a little messier.
Thanks, Albert
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
____________________________________________
Hi Tommy, Four choices: 1) If you don't have too much data.. use "GET" rather than "POST", then you can append to the URL as you've done. 2) Use hidden form fields. 3) Use cookies (again... if not too much data) 4) Use sessions -steve On Friday, August 3, 2001, at 10:34 PM, Tommy Johnson wrote:
Ok, I copied your scenario, and then printed out the REQUEST object. The only variable that shows up is submit, which means that Zope doesn't allow you to append querystring info in your form tag. That sucks.
I've always used hidden fields, but I see that you don't particularly care for that approach. Hmmmm..... any other ideas community?
Tommy
Innovation: The Best Way To Predict The Future ... Is To Create It.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Albert Ting Sent: Friday, August 03, 2001 4:49 PM To: zope@zope.org Subject: [Zope] can one pass values through the 'action' property?
I'm trying to do this:
<form action="get_row?row=3" method="POST"> ... <input type="submit" name="submit" value="submit"> .... </form>
However, "row" does not show up in the REQUEST namespace, even though a similar syntax works in a HREF tag. Can this be done? I know I can add a hidden input tag, but it's a little messier.
Thanks, Albert
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Tommy, 'Nuther thought. I'm not at all sure *what* you're doing, I think another track you might follow that's a little more "OO" is making a "game object" (e.g., a ZClass, or a Python Product, or even just a DTML Document or Folder that is playing the role of a specialized object. When someone wants to play your game... create a new game object for them with a unique ID, then point their browser to their own personal object that keeps state for them. More complex then sessions, but maybe better in some ways.. good luck! -steve On Saturday, August 4, 2001, at 06:04 AM, Steve Spicklemire wrote:
Hi Tommy,
Four choices:
1) If you don't have too much data.. use "GET" rather than "POST", then you can append to the URL as you've done.
2) Use hidden form fields.
3) Use cookies (again... if not too much data)
4) Use sessions
-steve
On Friday, August 3, 2001, at 10:34 PM, Tommy Johnson wrote:
Ok, I copied your scenario, and then printed out the REQUEST object. The only variable that shows up is submit, which means that Zope doesn't allow you to append querystring info in your form tag. That sucks.
I've always used hidden fields, but I see that you don't particularly care for that approach. Hmmmm..... any other ideas community?
Tommy
Innovation: The Best Way To Predict The Future ... Is To Create It.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Albert Ting Sent: Friday, August 03, 2001 4:49 PM To: zope@zope.org Subject: [Zope] can one pass values through the 'action' property?
I'm trying to do this:
<form action="get_row?row=3" method="POST"> ... <input type="submit" name="submit" value="submit"> .... </form>
However, "row" does not show up in the REQUEST namespace, even though a similar syntax works in a HREF tag. Can this be done? I know I can add a hidden input tag, but it's a little messier.
Thanks, Albert
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Actually this isn't a Zope problem but a problem with either the HTTP spec or your browser. I'm not sure the spec allows you to do this at all. Use hidden inputs, they achieve exactly the same result. Florent Guillaume Nuxeo
I'm trying to do this:
<form action="get_row?row=3" method="POST"> ... <input type="submit" name="submit" value="submit"> .... </form>
However, "row" does not show up in the REQUEST namespace, even though a similar syntax works in a HREF tag. Can this be done? I know I can add a hidden input tag, but it's a little messier.
Albert, I wouldn't say that there is a "right" way of doing it. Personally, I would prefer passing the variables in the REQUEST object rather that using Session. I've always used hidden fields, but I have on occassion passed it through the action property. Like I said, in ASP and ColdFusion it worked fine. If I use hidden fields, I always put them right before the submit button, that way I and all other developers who view my code will know exactly where to go to see hidden fields. I have also seen people who will always put them right after the opening <form> tag. That's a good idea also. Florent, Ok, if it works in Coldfusion and ASP, then there isn't a problem with 1. My browser 2. HTTP spec 3. Development language But if, now, I try to do the exact same thing in Zope, and it doesn't work, then how could you NOT say that it isn't a Zope problem? I'm not totally assuming that Zope is the problem, (assumptions can be deadly), but if it has worked before, and doesn't work now with a new development language, then where is the first place one should look? I'd be interested in input from developers who may have done this in PHP or other languages. If it also works in them.... The only thing that I can think of is if Zope parses differently from other languages. Meaning that if you choose to pass variables through the action property, then you MUST use Get rather than Post. In the other languages it didn't matter, but with Zope, it could potentially matter. I'll test it and write back. Just my 2 cents, Tommy Innovation: The Best Way To Predict The Future ... Is To Create It.
Nope, it doesn't matter if you use Post or Get. You get nada! Tommy Innovation: The Best Way To Predict The Future ... Is To Create It.
[followups to zope-dev] Tommy, You're right, I did the tests and it is indeed a Zope problem. What happens is this. If you have: <form action="/action?row=3" method="POST"> <input type="submit" name="submit" value="submit"> </form> Then what gets sent by Mozilla to the web server is: POST /action?row=3 HTTP/1.1 Host: ... ... Content-Length: 13 submit=submit And indeed there is enough information here to build a correct REQUEST with both row=3 and submit=submit. (However note that with a GET method, Mozilla sends: GET /action?submit=submit HTTP/1.1 So the GET method wouldn't work here anyway.) The culprit is ZPublisher.cgi.FieldStorage, who only looks at the QUERY_STRING if it's a GET or a HEAD. If everybody else does it, maybe Zope should do it... A word about the spec: HTML-4.01 says: * If the method is "get" and the action is an HTTP URI, the user agent takes the value of action, appends a `?' to it, then appends the form data set, encoded using the "application/x-www-form-urlencoded" content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes. * If the method is "post" and the action is an HTTP URI, the user agent conducts an HTTP "post" transaction using the value of the action attribute and a message created according to the content type specified by the enctype attribute. So the "get" part isn't even clear, what happens if the action already contains a '?'... the spec doesn't say. Note BTW that an URI with two '?' wouldn't be legal. Cheers, Florent Guillaume Nuxeo
Florent,
Ok, if it works in Coldfusion and ASP, then there isn't a problem with 1. My browser 2. HTTP spec 3. Development language
But if, now, I try to do the exact same thing in Zope, and it doesn't work, then how could you NOT say that it isn't a Zope problem? I'm not totally assuming that Zope is the problem, (assumptions can be deadly), but if it has worked before, and doesn't work now with a new development language, then where is the first place one should look?
I'd be interested in input from developers who may have done this in PHP or other languages. If it also works in them....
The only thing that I can think of is if Zope parses differently from other languages. Meaning that if you choose to pass variables through the action property, then you MUST use Get rather than Post. In the other languages it didn't matter, but with Zope, it could potentially matter. I'll test it and write back.
participants (4)
-
Albert Ting -
Florent Guillaume -
Steve Spicklemire -
Tommy Johnson