Re: [PEPr] +1 for HTML::HTML_QuickForm_SelectFilter

From: Date: Sat, 04 Dec 2004 11:22:05 +0000
Subject: Re: [PEPr] +1 for HTML::HTML_QuickForm_SelectFilter
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-34794@lists.php.net to get a copy of this message
Hi, Nicolas Hoizey wrote:
This kind of error handling in toHtml() does not seem like a good idea:
    function toHtml()
    {
        if (count($this->_targets) == 0) {
            // this filter as no target!
            return 'No target defined!';
I was not sure how to consider this. Is it an error? Maybe the right thing would be to return an empty string.
It's up to you to decide whether this is an error... If it is, return a PEAR_Error object, if it isn't you should probably just add a text box to the form without any JS.
You can also help users by automatically registering (using HTML_QuickForm::registerElementType()) the element type on class include.
If this element is added to HTML_QuickForm, I think it will be registered in HTML_QuickForm constructor.
I don't follow you on this. Please elaborate.

« previous php.pear.dev (#34794) next »