Re: [Quick Form] Validation

From: Date: Mon, 01 Jul 2002 09:23:31 +0000
Subject: Re: [Quick Form] Validation
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1784@lists.php.net to get a copy of this message
le 28/06/02 10:55, Frank Thiel à thier6@gmx.de a écrit : > Hello, > i´m not firm with regex. > I have got an input field with a default value eg Firma*. > How can i validate this field, first i can make a required, but as the > second validation part i wanna check if the default value changed. If it not > changed QuickForm will display an errormessage. > > Thanks Can you try to make your own validation function like this: function notDefault($element, $value, $defaultValue) { if ($value == $defaultValue) { return false; } else { return true; } } and use : $form->registerRule('notDefault', 'function', 'notDefault'); $form->addRule('txtElement', 'Please fill this one', 'notDefault', $myDefaultValue); It is not tested but I think it should work. Please let me know. Bertrand Mansion Mamasam

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