Welcome Guest, Not a member yet? Register   Sign In
How to set two call back function on same field
#1
Wink 

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.
Reply
#2

Did the callback return false? I don't really see any other reason it would stop going through the list of rules.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB