Does any body can know how to validate multiple entries for same field. I need to validate and save the data to DB table. I tried with validation rule method that we normally use to validate data, but validation function returns 1 i.e. True instead of error. Also I enclosed validation rules in an extra array steal it is not working.
Please guide me to validate the data for multiple entries.
Controller code
$this->MyModel->set($this->request->data);
if($this->MyModel->validates()){
//Some code
}else{
pr($this->MyModel->validationErrors);
}
output of submitted form :
Array
(
[MyModel] => Array
(
[0] => Array
(
[qualification_id] =>
[stream] =>
[pass_year] =>
[description] =>
[resume_id] => 1
)
[1] => Array
(
[qualification_id] =>
[stream] =>
[pass_year] =>
[description] =>
[resume_id] => 1
)
)
)
MyModel validation rules:
public $validate = array(
array(
'resume_id' => array(
'notEmpty'=>array(
'rule' => 'notEmpty',
'message' => 'Invalid resume reference.'
),
'numeric' => array(
'rule' => 'numeric',
'message' => 'Invalid resume reference.'
)
),
'qualification_id' => array(
'notEmpty'=>array(
'rule' => 'notEmpty',
'message' => 'Please enter qualification.'
),
'numeric' => array(
'rule' => 'numeric',
'message' => 'Invalide qualification selected'
)
)
)
);
Thanks,
Parag C.