[pmwiki-users] wikiforms recipe adds "attach" field type

John Rankin john.rankin at affinity.co.nz
Wed Sep 12 19:34:30 CDT 2007


The wikiforms recipe at 
http://www.pmwiki.org/wiki/Cookbook/WikiForms 
now supports Attach: markup using a new field type.

(attach extension1|extension2|...) produces a link 
to Attach:fieldvalue.extension where "extension" is 
selected from a radio button list

(attach extn) produces a link to Attach:fieldvalue.extn

(*attach ...) produces a link to [[(Attach:)fieldvalue.extension]]

For example, a FormTemplate entry like this:

:Attachment:filefield (*attach png)

generates a form field like this:

Attachment Attach:[                ].png

and produces markup like this:

:Attachment:[[(Attach:)fieldvalue.png]]

Another example, a template entry like:

:Attachment:filefield (attach png|*gif|jpg)

generates a form field like this:

Attachment Attach:[                ]. ( ) png (x) gif ( ) jpg

and markup like this (ext is the selected extension):

:Attachment:Attach:fieldvalue.ext

The asterisk causes that value to be selected by default.

If the fieldvalue contains internal spaces, these are 
changed to underscores.

I have tested the code quite carefully, but as usual, 
early adopters of this new feature should be on the 
lookout for bugs.

Thanks to Kathryn Andersen for suggesting this on 
WikiFormsRecipes. I didn't implement it quite the
way Kathryn suggested, but am open to ideas for
improvements.

Questions and comments welcome.
-- 
JR
--
John Rankin

       \_      
        \)   
         \,\__/7
         /    /
        (   c'
         \  / 
     /,  /_/  
    |  & *   Wellington
    )  /    
   /  /,    
  /  (    
 |   /      
 \__/       
   V        






More information about the pmwiki-users mailing list