Building "Advanced Search" like forms using QuickForm

From: Date: Wed, 03 Nov 2004 14:06:33 +0000
Subject: Building "Advanced Search" like forms using QuickForm
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15314@lists.php.net to get a copy of this message
I've looked at HTML_Quickform and FormBuilder and have a few questions regarding its use for non-add/edit forms. I have seen the example using the QuickHtml renderer. Seems like too much work for custom forms. e.g "Advanced Search" form or many times one has "filter" forms associated with huge amounts of tabular data. Also, if one needs to display an add/edit form in a 2-col layout (for better space utilization) again I must write my own template. Basically, you first call addElement() to tell quickform about the elements and then use them in a 'template'. The moment I write my own template, I have to handle the display of form errors next to elements and that becomes a pain for each form. Having to write code in 2 places (one where you call addElement() and then the template) also does not seem very elegant. Any suggestions on doing this? Has anyone considered the following possibility of doing something like what you can do with apache struts (for Java)? Special tags are defined for form elements eg |<P>Username: <html:text property="username"/></P> When rendering this, the error is automatically shown next to the element. If you want fancy formatting, you can get hold of the errors and display them yourself. This way I don't have to construct form elements using addElement() separately and form developers need not worry about displaying error messages. The validation rules can be specified at the top template. One way might be to write an xsl transformer that converts files written like these into a format that can then be run thru the QuickHTML renderer. This will add to a performance problem as each form has to be parsed twice (once by the pre-processor and then by QuickForm). It might be possible to pre-process the templates first but then this introduces a "build" step that spoils the fun of being able to simple save files and refresh my browser to see the changes (not to mention slowing development). See http://formsess.sourceforge.net for something similar. It is based on smarty. As QuickForm is so popular I'd prefer direct support under QuickForm. Can QuickForm developers add direct support for something like this? Any better ideas? Thanks Ravindra Wankar |

« previous php.pear.general (#15314) next »