[pmwiki-users] forms and drop-down boxes (<select>)

John Rankin john.rankin at affinity.co.nz
Wed Aug 24 19:25:58 CDT 2005

On Thursday, 25 August 2005 2:22 AM, Joachim Durchholz <jo at durchholz.org> wrote:
>John Rankin schrieb:
>> The Cookbook:wikiforms recipe provides this capability.
>As does http://www.pmwiki.org/wiki/Cookbook/Input.
> > Modesty prevents me from saying how neat it is.
>Um... me too :-)))
Yeah, nice work!

One of these days, we may want to put some effort into bringing
the various forms options together...

In an ideal world, a single forms script ought to be able to
read in a formsmarkup.php script and produce a form, regardless
of the markup chosen, and be able to provide a mechanism for
processing the result.

At the moment, the different forms modules have taken different 
markup approaches to meet their different needs, they each have 
merits, but are mutually incompatible.
>Just say
>(:input menu mymenu:)
>(:input menuentry 'Menu entry #1':)
>(:input menuentry 'Menu entry #2':)
>(:input menuend:)
>You'll get back a variable named $_POST['mymenu'] that reads either 
>'Menu entry #1' or 'Menu entry #2' (or is unset if the user didn't 
>choose an entry).

The wikiforms syntax is terse and opaque in comparison:

:Cover alignment:cover alignment of cover text (left;centre;*right)

producing a prompt of 'Cover alignment', a $_GET or $_POST['cover'] 
variable, a tool tip on the prompt of 'alignment of cover text' and 
radio buttons for left, centre, and right, with 'right' checked.

:Watermark:watermark appears on every page (,draft,exposure draft,confidential,sample)

produces a prompt of 'Watermark' with a tool tip 'appears on every 
page', and a drop-down list of <empty>, draft, exposure draft, 
confidential and sample, for the $_GET or $_POST['watermark']
variable, empty by default.

The example is from a template page that generates a form with
18 variables plus a title.

In Jo's markup, combined with wiki markup, this would probably 
be written as (the use of a table is optional):

{Watermark|appears on every page} (:comment prompt and tool tip:)
(:input menu watermark:)
(:input menuentry '':)
(:input menuentry 'draft':)
(:input menuentry 'exposure draft':)
(:input menuentry 'confidential':)
(:input menuentry 'sample':)
(:input menuend:)

The prompt and tool tip relies on a markup extension recipe.

John Rankin

More information about the pmwiki-users mailing list