[pmwiki-devel] Select & Option Dropdown-list Markup

marc gmane at auxbuss.com
Tue Dec 12 12:40:59 CST 2006


Ben Stallings said...
> marc wrote,
> > Personally, I don't consider either of these fall into the complex forms 
> > category - but I use them routinely. We could wrap the required markup 
> > and function into a recipe, if you prefer.
> 
> I'm a convert -- I hadn't known about the label, fieldset, and legend 
> tags, and I guess I had assumed sites that used them were using 
> JavaScript or other tricks to get those effects.

:-)

> It seems that the 
> markup to produce these tags would be very simple, along the lines of

I currently use:

  function AuxForm($name,$attr) {
    $name = strtolower($name);
    $attr = PQA($attr);
    switch ($name) {
    case 'fieldsetend';
      $out = '</fieldset>';
      break;
    case 'fieldset';
      $out = "<fieldset $attr>";
      break;
    case 'legendend';
      $out = "</legend>";
      break;
    case 'legend';
      $out = "<legend $attr>";
      break;
    case 'labelend';
      $out = "</label>";
      break;
    case 'label';
      $out = "<label $attr>";
      break;	
    }
    return $out;
  }

  Markup('auxform', 'block',
    '/^\\(:(fieldset|fieldsetend|legend|legendend|label|labelend)(\\s.
*?)?:\\)/ie',
    "AuxForm('$1',PSS('$2'))");

but we could simplify it further with some end$ regex. So, usage is 
something like:

  (:input form "?action=logout" id=login:)
  (:fieldset class=fieldset:)
  (:legend class=legend:)
  {$AuthId}
  (:legendend:)

  (:CustMenu:)
  %center%(:input submit value='Logout' class=button:)%%
  (:fieldsetend:)
  (:input end:)

-- 
Best,
Marc




More information about the pmwiki-devel mailing list