Validation email doesnt work

Validation email doesnt work

schiefersoftschiefersoft Posts: 7Questions: 2Answers: 2

Hi All,
when I validate the field email:

Field::inst('users.emailadress')->validator( 'Validate::email', array('required' => false)),

I get the following ajax response

Fatal error: Call to undefined function DataTables\Editor\filter_var() in /home/pi/www/v3/php/datatableseditor/php/Editor/Validate.php on line 506

when I remove the validator it works fine!
What I am doing wrong?

regards Ralf

Answers

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    Could you confirm which version of PHP you are using please? It sounds like you might be using a early 5.3.x release? They had a few problems with namespaces that might result in this issue.

    There are two options:

    1. Update to 5.3.29 which is the newest 5.3 release from 2014 (which is EOL)
    2. You could change that line to be:
            return \filter_var($val, FILTER_VALIDATE_EMAIL) !== false ?
                true :
                $cfg['message'];
    

    This change is unlikely to be added to Editor as I believe it is a bug in the early 5.3.x releases.

    Allan

This discussion has been closed.