Re: Form.php - why returnStart ?

From: Date: Thu, 25 Jan 2001 09:40:32 +0000
Subject: Re: Form.php - why returnStart ?
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-1160@lists.php.net to get a copy of this message
Bertrand Mansion wrote: > > Hi Urs, hi Stig, hi all, > > I have been trying to use the Form.php class to generate a form with a mix > of text and file (upload) fields. > > Reading the code of that class, I couldn't figure out why there were start > and returnStart functions ? I may be mistaken but I think these two > functions could be put in just one ? Or maybe I am wrong and then I hope you > can explain me where is the difference. > > I was also thinking it could be useful to have a sort of template for > creating form cells instead of having to modify every return... functions. > > function returnTextRow($name, $title, $default = '', $size = > HTML_FORM_TEXT_SIZE) { > $str .= " <TR>\n"; > $str .= " <TH ALIGN=\"right\">$title</TH>"; > $str .= " <TD>"; > $str .= $this->returnText($name, $default, $size); > $str .= "</TD>\n"; > $str .= " </TR>\n"; > return $str; > } > > In the code, this supposes I have created a table and I want my header > beside my text field (which is how it is most of the time) but if I want it > somewhere else, I have to change html in every return... function. > > It would be also nice to have the possibility to add errors above the field > (ex: Don't forget to fill this field...) like they do in phplib oohform or > the normal form on phpwizard.net. > > Could you please explain me how this Form.php class works and if I missed > some features ? Templates in HTML_Form would be great. Once the "template war" is over (will it ever?) I think we should use whatever template spec comes out of that. The point with having start() and returnStart() methods is that you may not always be interested in output right away. If you are using HTML_Form in "deferred output mode", you need returnXxx methods for everything with output. - Stig

« previous php.pear (#1160) next »