Set rule for checkbox

I have four check box, I want to set rule if none of checked then print message "Please check A or B or C or D"

rule

public function rules()

{


	return array(


		array('A,B,C,D','safe'),


		


	);


}

Add a function to your model to handle the condition:


public function mustCheck($attribute, $params)

{

    // do your logic however you want...

    if ($this->A != 0 || $this->B != 0 || $this->C != 0 || $this->D != 0)

        return;

    else

        this->addError('', 'Please check A or B or C or D');

}

Then change your rules to use this function to check the values:


public function rules()

{

    return array(

        array('A,B,C,D','mustCheck'),

    );

} 

Thanks