[pmwiki-devel] markup advice needed: (:select:) tag?

Ben Stallings ben at interdependentweb.com
Fri Jun 8 17:16:35 CDT 2007


Hi, folks.  I'm in the process of adding a function to the DataQuery 
recipe that will generate select (drop-down menu) inputs based on a 
previously configured database query, and I could use some advice about 
the markup to avoid conflicts with other recipes.

Here's an example of how this feature will be used: Suppose you have 
defined a query to display and edit event registrations that are stored 
in a database.  Each record (page) in the registration table (group) has 
an event ID number and a person ID number, which correspond to records 
in other tables.  In order to display the registrations in a 
human-readable form, you have defined the query to pull the event's name 
and the person's name from two other tables which are joined to the 
registration table.  You want to provide a form whereby an administrator 
can add a person to an event by selecting the event's name and the 
person's name from a pair of drop-down menus.

It's already possible to do this with DataQuery using pagelists, but 
pagelists are so slow that if you have two or three drop-downs on a 
page, the page may time out and so cannot be used at all.  Plus, since 
DataQuery can't predict which field of the joined table you will want to 
use for labels, you have to manually create each drop-down's pagelist 
template, which is tedious and time consuming.  So I'm working to 
provide a faster, easier way to do it.

In UpdateForm, I used (:update select etc etc:) for this same 
functionality, because all of UpdateForm's tags were variations on 
(:update:).  But DataQuery doesn't use (:update:) tags (or any other 
custom markup), it uses regular (:input:) tags, and (:input select:) is 
already in use.  ZAP used to provide a (:select:) tag, but no longer 
does so, so I'm tempted to nab that markup unless someone objects.

Here's what I'm looking at:

  (:select name=eventid label=eventname:)
or just
  (:select eventid eventname:)
would pull the eventnames from the joined table and generate:
  (:input default eventid "{*$:eventid}":)
  (:input select eventid "1" "Kung Fu Fighting":)
  (:input select eventid "2" "Fish Slapping Dance":)
  ...
  (:input select eventid "42" "Brockian Ultra-Cricket":)

If no label is provided, for example
  (:select personname:)
then the labels would be taken from the same field where they are stored:
  (:input default personname "{*$:personname}":)
  (:input select personname "John Smith":)
  (:input select personname "Mickey Smith":)
  ...
  (:input select personname "Sarah Jane Smith":)

So, my question: Is (:select:) too general a tag name for this specific 
function?  If so, what would you suggest instead?  Thanks in advance for 
the feedback.  --Ben S.



More information about the pmwiki-devel mailing list