Re: QuickForm2 (rules involving to objects)

From: Date: Tue, 08 Jun 2010 08:21:30 +0000
Subject: Re: QuickForm2 (rules involving to objects)
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30610@lists.php.net to get a copy of this message
Hi, On 08.06.2010 10:51, Php Developer wrote:
I have a form where I want to force the user to fill either a text area or upload a file. I need help with that. Whey I did is not working: $objTextArea->addRule('required', 'Please provide a text or file version')
                   ->or_($objUpload->createRule('required', 'Please provide a text or file version'));
As there is no end-user documentation yet, consider reading at least phpdoc. Required Rule's _or() docs:
    * Disallows adding a rule to the chain with an "or" operator
    *
    * Required rules are different from all others because they affect the
    * visual representation of an element ("* denotes required field").
    * Therefore we cannot allow chaining other rules to these via or_(), since
    * this will effectively mean that the field is not required anymore and the
    * visual difference is bogus.
You'll need to use 'nonempty' Rule instead of 'required'.

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