HTML_QuickForm2_Rule_Callback: inverting callback rule results

From: Date: Tue, 04 May 2010 07:40:17 +0000
Subject: HTML_QuickForm2_Rule_Callback: inverting callback rule results
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30492@lists.php.net to get a copy of this message
Hi, I am in the need to verify the user name in a registration form. Part of that process is using the existing API to check various things, including - reserved user names - already existing user names - validity of a user name Methods are something like - $userservice->isUsernameReserved() - $userservice->existsUser() - $userservice->isUsernameValid() I cannot use them with the normal callback rule, since the API methods return true when something is wrong for the name the user put into the form. There are two options now: 0. Extend the API. This is not always feasible 1. Write custom methods that invert the results of the API 2. Get the callback rule to invert the results of the method call Of course I would prefer number 2, since adding a "'inverted' => true" option to the callback rule is much easier and faster than defining an own function/adapting the API. What do you think about that? -- Regards/Mit freundlichen Grüßen Christian Weiske -= Geeking around in the name of science since 1982 =-

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