[Zope] filename property of variable

Thomas B. Passin tpassin@mitretek.org
Mon, 9 Jul 2001 13:45:39 -0400


Laurie, I think this might be what you want.  At least, it will let you
access each (unknown) form variable by name and get its value.  The slightly
odd expression "_[_['sequence-item']]" gives you the value because the
variable name is sequence-item,  if you do it like this.

<dtml-in "REQUEST.form.keys()">

    <!-- Show <name>:<value> -->
    <dtml-var sequence-item>:<dtml-var "_[_['sequence-item']]">

    <!-- Apply "if" test to see if variable has a value -->
    <dtml-if "_[_['sequence-item']]"> (passed "if" test)</dtml-if><br>

</dtml-in>

Try that on your form and see if it shows you the filled-in values.  It does
on my test form.  If you can render them, you ought to be able to do
anything else you want.

Cheers,

Tom P

[Laurie Nason]

>
> There are no other form variables besides these on this form - and the
name
> is actually the name of a ZClass instance, in which I wish to create my
> image file. One in each instance.
>
> Laurie
>
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Thomas B. Passin
> Sent: Monday, July 09, 2001 11:21 AM
> To: Zope
> Subject: Re: [Zope] filename property of variable
>
>
> Can you have other form variables besides the upload boxes?  Can there be
> more than one on a page with the same name?
>
> Tom P
>
> [Laurie Nason]
> > I have a page of multiple upload file boxes - the name of each one is
> > generated on the fly so I don't know what the name will be when I get to
> the
> > dtml method to upload the images. I also don't know how many of them
will
> > actually have an image to upload. Hence, after much trawling through
> > previous posts I found the following code to check to see if the user
has
> > actually selected a file to upload:
> >
> >      <dtml-if "newimage.filename">
> >
> > How do I use this with 'sequence-item'?
> >
> > I have tried:
> >
> >      <dtml-if "_['sequence-item'].filename">
> >
> > Any ideas?
> >