[Zope-dev] HowTo: trying to acces only the form elements in the REQUEST ...

Siggy Brentrup bsb@winnegan.de
13 Mar 2001 10:11:08 +0100


Holger Lehmann <lehmann@catworkx.de> writes:

> Hello everyone,
> 
> I need a quick hint.
> 
> How do I check wether there are any "form" elements in the request.
> And how can I only acces those ?
> I want to pass those, and only thos on to a ZClient call to another website. 
> 
> I do have a request like this:
> http://server/foo/bar?name=bar&param=foo&param2=baz
> 
> Now I want to isolate name, param and param2.
> I need to construct a request like this:
> <dtml-if <any parameters at all>>
>   <dtml-in <all form parameters in REQUEST>>
>     ..... do something
>   </dtml-in>
> </dtml-if>

Some hints to play with (tested on 2.3.0):

<dtml-if "REQUEST.form">
  <dtml-var "REQUEST.form"><br>
  <dtml-var "REQUEST.form.keys()"><br>
  <dtml-var "REQUEST.form.values()"><br>
  <dtml-var "REQUEST.form.items()"><br>
  <dtml-in "REQUEST.form.items()">
    <br><dtml-var sequence-index>: <dtml-var sequence-key>=<dtml-var sequence-item>
  </dtml-in>
<dtml-else>
  No parameters given!
</dtml-if>

Regards
  Siggy

-- 
Siggy Brentrup - bsb@winnegan.de - http://www.winnegan.de/
****** ceterum censeo javascriptum esse restrictam *******