Re: HTML_QuickForm2 rule chaining
| From: | Alexey Borzov | Date: | Wed, 05 May 2010 15:11:53 +0000 |
| Subject: | Re: HTML_QuickForm2 rule chaining | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-30508@lists.php.net to get a copy of this message | ||
Hi Christian,
On 04.05.2010 20:55, Christian Weiske wrote:
When adding multiple rules to an qf2 element, using the fluent interface does not work anymore - every addRule() call returns the created rule and not the element. I do see that this is needed for further rule modifications or using them in and/or chains, it makes the simple cases more complicated. What about a copy of addRule() that returns the qf element? Instead of1) Please note that addElement() you are using in your example returns the added element rather than the form. Do we need addElementF() also? 2) What exactly are you trying to achieve here? Saving a few keystrokes by not having to type $el a couple of times?$el = $form->addElement(..); $el->addRule(...); $el->addRule(...); $el->addRule(...);one could use$form->addElement(..) ->addRuleE(...) ->addRuleE(...) ->addRuleE(...)What do you think about that?