Sorry for doubling my post but the first post it didn't pass because I
missed to fill the subject and after I entered subject that is the
result :(
On Oct 29, 3:54 pm, senser <[EMAIL PROTECTED]> wrote:
> 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=allow...http://groups.google.com/group/cake-php/browse_thread/thread/2d533160...http://groups.google.com/group/cake-php/browse_thread/thread/2d533160...
>
> 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
-~----------~----~----~----~------~----~------~--~---