Login Retreive lost passwordRegister
Search

Forum Index / Feedback / Multiple Email Validation

[ This topic is solved ]

  fulvio 14 January 10 / 16:20  
It could be a good ideia to add the following to FH3 version.
Validate field with multiple emails, separate by an ","

classValidator.php

    //Validate multiple email separate by ","
    function IsMEmail($value)
    {
        $output = 1;
        $Memail = explode(",", $value);
        foreach($Memail as $key){
            $email = trim($key);
            $output = $output & $this->IsEmail($email);
            if(!$output) break;
        }
        return $output;
        
    }
    
    function _IsMEmail($value)
    {
        return StrLen($value) == 0 || Validator::IsMEmail($value);
    }    
    
    //Validate multiple email host separate by ","
    function IsMEmailHost($value)
    {
        $output = 1;
        $Memail = explode(",", $value);
        foreach($Memail as $key){
            $email = trim($key);
            $output = $output & $this->IsEmailHost($email);
            if(!$output) break;
        }
        return $output;
        
    }
    
    function _IsMEmailHost($value)
    {
        return StrLen($value) == 0 || Validator::IsMEmailHost($value);
    }


classFormHandler.php


define('FH_MEMAIL',     'IsMEmail',    true);    // a valid email address list (only checks for valid format: <a href='mailto:xxx@xxx.xxx'>xxx@xxx.xxx</a>,xxx@xxx.xxx,xxx@xxx.xxx,......)
define('FH_MEMAIL_HOST','IsMEmailHost',true);    // a valid email address list with host check (only checks for valid format: <a href='mailto:xxx@xxx.xxx'>xxx@xxx.xxx</a>,xxx@xxx.xxx,xxx@xxx.xxx,......)

define('_FH_MEMAIL',      '_IsMEmail',     true);
define('_FH_MEMAIL_HOST', '_IsMEmailHost', true);

  Johan Wiegel (Admin) 14 January 10 / 16:30  
It's a nice custom validator, but we will not add this one to FH.

  Top


powered by PHP-GLOBE   © 2004 - 2012 FormHandler. All rights reserved.   -   Open source license