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

John Rankin john.rankin at affinity.co.nz
Mon Aug 13 21:25:49 CDT 2007


On Tuesday, 14 August 2007 12:34 PM, Sameer Kumar <skumar at eharch.com> wrote:
>
><snip>
> 
>I have tested this more carefully now and I think it works to
>specification (although perhaps it's not what you want).
> 
>When you define the field in the template as specified above,
>the content of the created page becomes
> 
>:Image file:Attach:Image_{$Name}.png
> 
>PmWiki translates this as a link to Image_00001.png or
>Image_00002.png etc. So every page has a link to a
>uniquely-named image.
> 
>>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
>> 
>And this is correct behaviour for the hide field type. 
> 
>When you say it does not work, what, precisely, do you
>want it to do? I had understood that you wanted to specify
>the name of the uploaded file, which this does.
> 
>I thought that the " Attach:Image_{$Name}.png" should show up
>as a link, isn't it? And that clicking the link would take me
>to the standard upload form where the image name will be
>prefilled. As of now, it does not come up as a link. It shows
>up as simply text.
> 
> 
Think it through...

When you see a form, you are looking at a page's content
in edit mode, so markup appears as markup, not as an 
HTML link. The 

Image: Attach:{$Name}_Image.png

text in the form tells you the value that the field will
have when the page is saved. If you fill in the form and
press Submit, then Save the new page, you will see
the page, in browse mode, with that field value
displayed as an Attach: link, and {$Name} resolved as
the numeric pagename, ensuring a unique image name.

Of course, your ViewTemplate must include that field.

If you think about it some more, you will see that if
the hide text  resolves as a link, for your NewEntry page,
it will always carry the name of the NewEntry page, not
the name of the page with which you want to associate 
each image, ie 00001, 00002, etc.

All we are doing with the hide field type is forcing a field 
to contain some pre-defined wiki markup. We don't see
the effect of the markup until we save the page.

-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list