your valaidation logic is very helpful to me... i want to ask
another one doubt to u , in ur example u given three text
fields are validated in built in method.. i am asking abt how to
validate the file field. example( upload file filed).
If i try to validate , the error message displayed in above three
text fields... file field have not displayed when
submitting the empty data.
In my model :
function validate($ary_test_info){
$ary_error = array();
for($i=0; $i<1; $i++){
if(!$this->isEmpty($ary_test_info['Test']['photo'][$i]['name'])||
!$this->isEmpty($ary_test_info['Test']['name'][$i])||
!$this->isEmpty($ary_test_info['Test']['mark1'][$i])||
!$this->isEmpty($ary_test_info['Test']['mark2'][$i])){
}else{
if ($this->isEmpty($ary_test_info['Test']['name'][$i]) ){
$ary_error['name'][$i] = 'Please select name';
}
if ($this->isEmpty($ary_test_info['Test']['mark1'][$i]) ){
$ary_error['mark1'][$i] = 'Please select mark1';
}
if ($this->isEmpty($ary_test_info['Test']['mark2'][$i]) ){
$ary_error['mark2'][$i] = 'Please select mark2';
}
if ($this->isEmpty($ary_test_info['Test']['photo'][$i]['name']) )
{
$ary_error['photo']['name'][$i] = 'Please select photo';
}
return $ary_error;
}
}
}
now how to assign the error message into controller and how to
validate the upload file field...
with out using built in validation method..
let me know ur suggestion
by
sundar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment