![]() |
How to set two call back function on same field - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: How to set two call back function on same field (/showthread.php?tid=61686) |
How to set two call back function on same field - pankajdurve - 05-05-2015 When i set two different callback function on same field.only one callback function is called ,out of two for example: $config = array( array('field' => 'userfile', 'label' => 'Userfile', 'rules' => 'callback_check_extension|callback_check_image', 'errors' => array('check_extension'=>'Please upload Jpg/jpeg/gif/png image','check_image' => 'Invalid image.')), ); function check_image() { $a=$_FILES['userfile']['size']; if($a > 9000) { return false; } else { return true; } } function check_extension() { $a=array("image/jpeg","image/jpg","image/png","image/gif"); $info=$_FILES['userfile']['type']; if(in_array($info,$a)) { return true; } else { return false; } } ---------------------- but when i run this program,that time only one callback function is calling ,out of two. RE: How to set two call back function on same field - mwhitney - 05-06-2015 Did the callback return false? I don't really see any other reason it would stop going through the list of rules. |