[pmwiki-users] Attach form field type (was: More answers to:More Wikiforms)

John Rankin john.rankin at affinity.co.nz
Mon Aug 13 18:14:10 CDT 2007


On Saturday, 11 August 2007 4:44 AM, Sameer Kumar <skumar at eharch.com> wrote:
>
><snip>
>In that case, you might be better using the "hide" field type;
>for example:
> 
>:Image file:image (hide Attach:Image_$Name.png)
> 
>This will force the value of the field to be (for page 00001)
>Attach:Image_00001.png
> 
>I included the page name to guarantee a unique file name.
><snip>
> 
>The above field markup does not work.
> 
>This is what I put in the FormTemplate:
>:Image:image (hide Attach:Image_$Name.png)
> 
>This is what I got on my Projects.Add form, without an input box:
> 
>Image:          Attach:Image_{$Name}.png
> 
On my system, the form returns

Image: Attach:Image_00001.png

You stated that you wanted to use a specified image name and this is what 
the 'hide' option does -- forces a field to have a specific value. If the field 
has a specific value, by definition, the author can't change it, so there is
no input box generated.

I do not know why the $Name is not being translated -- it works for me.

However, I now don't think this will give you what you want -- the $Name
will not always contain the desired value. You may be better to put the
image attach into the GroupFooter or GroupHeader:

Attach:{$Name}_image.png

for example. Of course, this will put the image at the top or bottom of the page.

If you want the author to specify the file name, that will require the
enhancement I described before. I am not sure when this will be
available, as I have to think through how best to implement it. It's
not hard, but it's fiddly to get right.


-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list