Re: Quickform: How to add a feature ?
| From: | Alexey Borzov | Date: | Thu, 01 May 2003 20:35:46 +0000 |
| Subject: | Re: Quickform: How to add a feature ? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5174@lists.php.net to get a copy of this message | ||
Hi!
ThE PhP_KiD wrote:
Can you tell me how can I add this feature to QuickForm::select package ? OR... Can I add this like $form->addElement('html','...') ? how must I proceed ?I don't think this belongs to HTML_QuickForm_select, adding this as static html looks ugly, too. But a new element type would be a good idea. You'd have to create a new element class that will extend HTML_QuickForm_element (or maybe HTML_QuickForm_group), then register it, then you'll be able to do $form->addElement('kewlselect', ...) I'd suggest looking at HTML_QuickForm_date and HTML_QuickForm_advcheckbox sources for inspiration. Note that you need to implement an onQuickFormEvent() method in your class, that has to manage setting the element's value and (in your case) adding 'onsubmit' javascript to the form object (look at HTML_QuickForm_file for inspiration here) that will not break clientside validation or be broken by it.