validators:email = true… not working
Archived from the Xataface Users forum.
Cabeza — Sun Sep 16, 2012 12:53 pm
Steve,
I set on fields.ini of the corresponding table:
[email]
validators:email = true
validators:regex:message = …
And now there is no way to go past the field, regardless of the input format.
I see (on the apache error.log)
PHP Warning: preg_match(): Empty regular expression in /Library/WebServer/Documents/xataface/lib/HTML/QuickForm/Rule/Regex.php on line 61, referer: http://localhost/…/index.php
I tried to do some tracing and it appears that effectively $regex is empty when testing if (!preg_match($regex, $value)…but after hours of trying I can’t pinpoint where in the chain of calls to validate() the thing is lost .
Any suggestions?
Thanks!
shannah — Mon Sep 17, 2012 8:55 am
validators:regex:message should always accompany a validators:regex directive. Otherwise you’ll get this error when it tries to compile a null regex.
Perhaps you mean validators:email:message ?
-Steve
Cabeza — Mon Sep 17, 2012 9:59 am
Oh my! I knew it had to be something stupid, and there you are.
You are right, I was trying with validatiors:regex:message instead of …:email:… Oh well.
(I have to say, I did learn a lot about the HTML_QuickForm implementation of regexp on the way )
(Which reminds me: preg_match() is able to gobble up Perl’s ‘/\p{L}/’ for Unicode letters no problem. But it appears to be no go using validators:regex: Any idea way?
I could not make it work to check unicode strings, and ended up using
validators:regex = ‘/^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ]+$/’ which we will all agree is not as elegant…
Thanks once more (and it will not be the last).
BTW - thanks for the clean implementation of widget:atts:… it allowed me to incorporate the opentip (http://www.opentip.org) framework pain-less-ly. You are good.
Cheers.