| Heiko Sudar 2007-12-04, 4:08 am |
| Hi,
to call a php-function for validation is, in my opinion, a server side
validation, but you call it from the client-side.
Actually I have the same problem. What I do is to make the client-side
validation via ajax. You can call js-functions the same way that you =
call
php-functions. Maybe this is worth a try for you.=20
Please let me know if it works...
Thanks!
-----Urspr=FCngliche Nachricht-----
Von: batterhead [mailto:batterhead@gmail.com]=20
Gesendet: Dienstag, 4. Dezember 2007 05:24
An: pear-general@lists.php.net
Betreff: [PEAR] QuickForm Custom Rule Question
Hi all,
I am using a custom rule to check a credit card number with the
Validate package. I know validation function works because I tested
outside the form.
I am just not sure how to properly call it even though I have been
studying the examples... It just don't work. Any help would be
appreciated.
// Require Database
require("Validate/Finance/CreditCard.php");
// callback function for credit card validation
function validCCNum($card) {
$ccType =3D $card[0];
$ccNum =3D $card[1];
$result =3D Validate_Finance_CreditCard::number($ccN
um, $ccType);
return $result;
}
$form->addElement('select', 'gcCCType', 'CC Type:', $cc);
$form->addElement('text', 'gcCCNum', 'CC Number:', array('size' =3D> 25,
'maxlength' =3D> 25));
$form->registerRule('validatecc', 'callback', 'validCCNum');
$form->addRule(array('gcCCType','gcCCNum'), 'Credit Card Number is Not
Valid', 'validatecc', 'client');
Thanks!
--=20
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|