I tried this and it doesn't differentiate between ones where the user has entered a file to upload and ones where they haven't. I really need to be able to call the .filename method to see if it has one - but _['sequence-item'].filename doesn't like the fact that the _['sequence-item'] returns a string (thanks Casey again on a different post!) rather than the object itself. What I would like to be able to do is to call <dtml-if expr="_.getitem(sequence-item).filename"> But you can't escape the sequence-item again due to the fact that it returns a string...AARRGGHHH!!! Any ideas??? Laurie #B^( -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Thomas B. Passin Sent: Monday, July 09, 2001 12:46 PM To: Zope Subject: Re: [Zope] filename property of variable 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?
_______________________________________________ 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 )