[pmwiki-users] (:input select ... :) markup prototype

Patrick R. Michaud pmichaud at pobox.com
Mon Dec 11 17:27:13 CST 2006


On Mon, Dec 11, 2006 at 11:06:17PM +0000, Hans wrote:
> It looks very promising. Great to see multiple choice support,
> and vertical size support. I guess horizontal size could be
> manipulated with css via name for instance #abc {width:10em;} ?
> 
> But there is a lot of repetitive code:
> 
> (:input select name=abc 1 alpha :)
> (:input select name=abc 2 beta  :)
> (:input select name=abc 3 gamma :)
> 
> instead of
> 
> (:select abc:)
> (:opt 1 alpha :)
> (:opt 2 beta  :)
> (:opt 3 gamma :)
> (:selectend:)
> 
> Of course I see that including name=abc avoids the first and last
> line (select, selectend). 

...and this is a *huge* advantage when generating select boxes
from pagelists, since we don't have to generate the initial select
and selectend directives.  It also means we don't have to deal
with the weird case where an author forgets the select/selectend.

> But it will make it bulky if you use a lot of options.

I've been thinking that it can be:

    (:input select name=abc 1 alpha :)
    (:input select 2 beta:)
    (:input select 3 gamma:)
    (:input select 4 whatever:)

So far I've somewhat avoided this because it goes against
the pattern of most of the other (:input:) markups.  Having
the single name= parameter as above means that the generic form is

    (:input select   <value> [<label>]:)

whereas many (but not all) of the other input controls have the form

    (:input text     <name> [<value>] :)
    (:input radio    <name> [<value>] :)
    (:input checkbox <name> [<value>] :)

Note specifically (:input radio:), where the name is repeated for 
each control regardless of the number of buttons, just like select
does now.

So, the prototype I started with follows the pattern used by
(:input radio:) and friends, even if it makes the markup a little
more bulky.  And it really matters only for select boxes that
are being maintained by hand -- for a pagelist-generated box
the bulk of doing it this way is much less.

Personally I can go either way on the issue, which is why I'm
curious to get feedback from others.

> Can the <select> tag carry a class='inputbox' ?

Yes, we can set a default for the select and it can also
be specified in the markup:

    (:input select name=foo abc 1 class='inputbox otherclass':)

(The class= argument only has to appear on one of the options --
if specified in multiple options, the last one wins.)

Pm




More information about the pmwiki-users mailing list