val_fun example

A collection of tutorials and posts that show additional functionality of MATE

Moderator: KarelB

val_fun example

Postby admin » Mon Dec 01, 2008 4:42 pm

Someone asked me to give an example on how to use the val_info option so here it goes.

Code: Select all
$tableColumns['email'] = array('display_text' => 'Email', 'perms' => 'EVCTAXQS','val_fun' => array(&$this,'valEmail'));


Code: Select all
   function valEmail($col,$val,$info)
   {
      if (preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $val) || preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/',$val))
      {
         return true;
      }
      else
      {
         return false;
      }
   }
admin
Site Admin
 
Posts: 1457
Joined: Fri Jul 11, 2008 1:34 am

Return to How To

Who is online

Users browsing this forum: No registered users and 1 guest