Re: QuickForm Compare Rule
| From: | Justin Patrin | Date: | Sat, 12 Mar 2005 21:26:17 +0000 |
| Subject: | Re: QuickForm Compare Rule | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18009@lists.php.net to get a copy of this message | ||
On Sat, 12 Mar 2005 10:42:55 -0800 (PST), fluidliqatyahoodotcom
<fluidliq@yahoo.com> wrote:
> How can I compare more than 2 input fields? I want to compare quite a number of select elements
> and make sure they are all not the same.
> The compare validation that comes with PEAR can only do comparison with 2 elements.
> I need something which I will pass an array string to the first parameter of the addRule
> function and let all the elements in the array to be validated.
>
> I tried to create a custom rule function but it didn't work.
> If I have an array of elements, what will the $element_name and the $element_value of the
> callback function be like? I tried something like var_dump to check the variables but it didn't
> work.
>
> Also, I tried putting just a line return false; in the callback function but when I try on the
> form, no matter what, there was no error reported.
> That is weird.
>
Check the docs, the callback should return true if everything is ok
and array('elementName' => 'error message', 'elementName2' =>
'error
message2') if there was an error.
--
Justin Patrin