Using Rules Validation

Hello,

please check out this bit of code

///////////////////////////////////

public function rules(){


	return array(





array("policy_fee,payment_method,policy_duration","required"),


array("cash_investment,total_amount,inflation_protector,total_premium","safe"),


array("policy_duration","numerical"),


array('cash_investment', 'match', 'pattern'=>'/^[0-9]{1,3}(\.[0-9]{0,2})?$/'),


array('total_premium', 'match', 'pattern'=>'/^[0-9]{1,3}(\.[0-9]{0,2})?$/'),


array('total_premium','chkPremium'),


		        );





		  }


		  


public function chkPremium($attribute,$params)

{

if($this->$attribute !=100){


  $this->addError($attribute,'Incorrect username or password.');


  }

}

////////////////////////////

As you see, i am trying to get the error out through the rules method for chkPremium

This is just not working as it should. That is no error is coming up

I would appreciate any help,

merci beaucoup!

Hi,

you should debug (with firebug for instance) to see if you go through your addEerror or if it’s only a display problem.

Bonne chance.

Hi lefootballroi

post your view _form.php code

also check by


if($this->$total_premium !=100) { ... }