Hi,

After upgrading to CakePHP 1.2.0.5875 from 1.2.0.5427 I can't set
validation for form fields that are NO obligatory. Untill now I used
this code ana everything seemed to work fine:

/********MODEL SNIPPET************/
var
$validate=array('reminder'=>array( 
'required'=>array('rule'=>array('required'=>false)),
                                                                        
'allow_empty'=>array('rule'=>array('allowEmpty'=>true)),
                                                                        
'date'=>array('rule'=>array('date', 'format'=>'ymd')),
                                                                        
'length'=>array('rule'=>array('between', 10, 10)),
                                                                        
'valid_date'=>array('rule'=>array('validReminderDate')));
/********************************/
 The idea was if user doesn't enter reminder date and validation of
this field passes, but if he enters some values field must be
validated as a valid date in the future (this is the custom validation
rule called validReminderDate). This worked fine for me with previous
version, but now if the reminder_field is left blank the form doesn't
validate.

I have read all the topics in GoogleGroups relevant to this bu I
didn't find a solution:
http://groups.google.com/group/cake-php/search?group=cake-php&q=allowempty&qt_g=Search+this+group
http://groups.google.com/group/cake-php/browse_thread/thread/2d5331603a513a27/287ab486bcb1cdd4?lnk=gst&q=allowempty#287ab486bcb1cdd4
http://groups.google.com/group/cake-php/browse_thread/thread/2d5331603a513a27/111fdf00df16bc03?lnk=gst&q=allowempty#111fdf00df16bc03

The theme is discussed many times but still doesn't have safe and
hopeful cakephp_native solution ..... or may be I miss something.

I'm really stuck with this validation problem.

Give me some help pls.

P.S.
Set::filter is not a solution  - if user doesn't fill obligatory field
filter deletes the name of the field from array and that breaks
validation. And allowEmpty rule is only enforced when there is an
actual fieldName index in the data array.
I even tried to set empty fields to NULL in beforeValidate but no
success again


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to