Hi Thomas,
Thanks for the reply.
What is validated is the output of an HTML form. So everything comes in
as a string. The format of the string is intentionally crap, something
like "dkfj;sdrfhpthqew;rjhn;kfhe" to mimic the behavior of some very
irritating spambots.
The reason I use a very simple regex validator, that still allows for
/invalid /phone numbers, is that if someone enters a value that is
definitely not part of a phone number, like x or a, the validator will
return false and the spambot will not succeed in sending the form.
I simply can't see why the input should conform to a certain type, while
I am checking against a pattern. By the way, the type is string, which
is valid according to the validator message. Also note that this
validator AND setting a custom message used to work, so it is broken
since some recent point in time.
Any help still appreciated, but if I am /not /wrong in how I use it, I
would like to know if others are encountering the same issue and if an
issue is/needs to be filed in the issue tracker.
-Bart
Thomas Weidner schreef:
The regex validator has also a INVALID message which you did not set.
Which type has the value you want to validate ? Try a var_dump of the
value.
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message ----- From: "Bart McLeod" <[email protected]>
To: "fw-general" <[email protected]>
Sent: Thursday, July 09, 2009 2:17 PM
Subject: [fw-general] Zend_Validate_Regex issue
Hi all,
I searched the mailing list and the issue tracker, but I can't find
an issue for this. However, I would like to double check with you
all, before creating a new issue. Maybe I am just coding wrong or
there already exists an issue that you can point me to.
Here's the problem:
I add a Regex validator to a form.
I set the a custom message on Zend_Validate_Regex::NOT_MATCH.
I do not get the custom message, but instead I get:
"Invalid type given, value should be string, integer or float"
Which makes no sense at all (at least to me).
Anyone?
My version is latest trunk, it also affects existing solutions that
worked fine for months.
The code:
$phoneValidator = new Zend_Validate_Regex($pattern);
$phoneValidator->setMessage("U mag de volgende tekens
gebruiken: + - ( ) een spatie en cijfers.",
Zend_Validate_Regex::NOT_MATCH );
$telephone->addValidator($phoneValidator);
$form->addElement($telephone);
Regards,
Bart McLeod