Zend framework2 email validation for specific address like for gmail and to block a specific email address -


i have input filter email address , want restrict specific email service provider, please me out this.

i have 1 more form , want allow restricted email service provider registered here. please tell me how can restrict 1 particular email service provider , in form allow 1 specific email service provider.

thanks in advance

$inputfilter->add($factory->createinput(array(                 'name'     => 'email',                 'required' => true,                 'filters'  => array(                     array('name' => 'striptags'),                     array('name' => 'stringtrim'),                 ),                 'validators' => array(                     array(                         'name'    => 'emailaddress',                         'options' => array(                             'messages' => array(                                  'emailaddressinvalidformat' => 'email address format not invalid',                              )                         ),                     ),                     array (                          'name' => 'notempty',                          'options' => array(                              'messages' => array(                                  'isempty' => 'email address required',                              )                          ),                      ),                   ),             ))); 

add regex validator:

        $inputfilter->add($factory->createinput(array(             'name'     => 'email',             'required' => true,             'filters'  => array(                 array('name' => 'striptags'),                 array('name' => 'stringtrim'),             ),             'validators' => array(                 array(                     'name'    => 'emailaddress',                     'options' => array(                         'messages' => array(                             'emailaddressinvalidformat' => 'email address format not invalid',                         )                     ),                 ),                 array (                     'name' => 'notempty',                     'options' => array(                         'messages' => array(                             'isempty' => 'email address required',                         )                     ),                 ),                 array(                     'name' => 'regex',                     'options' => array(                         'pattern' => '/@gmail.com$/',                         'messages' => array(                             'regexnotmatch' => 'you must have gmail.com email address'                         ),                     )                 ),             ),         ))); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -