[cvs] commit: horde/lib Form.php horde/lib/Form Renderer.php
tech at oblo.com
Fri Apr 25 02:30:01 PDT 2003
mdjukic 2003/04/25 01:30:01 PDT
horde_form now has collapsable sections for dealing with those long forms in a more compact way. i'm not totally convinced of the approach to doing this, but i've tried to be as least disruptive to existing code as possible. i'm sure it can be improved on.
- sections are specified as follows, e.g.:
$this->addVariable(_("Name"), 'name', 'text', true);
$this->setSection('contactdetails', _("Your contact details"));
$this->addVariable(_("Phone"), 'phone', 'text', true);
$this->addVariable(_("Email"), 'email', 'email', true);
$this->setSection('personaldetails', _("Your contact details"));
$this->addVariable(_("Date of birth"), 'dob', 'monthdayyear', true);
- each setSection() call sets a flag in the class to group all subsequent variables in this section until the end or until another setSection() call.
- the second parameter passes a description which would display inside the section header (making it look exactly like the existing 'header' type).
- in terms of changes to the code logic, addVariable now adds to _variable[<currentsection>] array.
- this also means that addVariable can be called at the end of a script and still add a variable to the beginning of a form by specifying the right section.
- ... TODO: setting collapse/expand states before first form rendering, and it would be good to figure out a non-js way of doing this, maybe dummy submits of the form.
Revision Changes Path
1.102 +48 -14 horde/lib/Form.php
1.59 +70 -44 horde/lib/Form/Renderer.php
More information about the cvs