Thanks a lot for helping me out.  I tried it out and it works well.
Like you said, it makes sense to keep this logic in the Model.

Thanks again,
-stev

On Jan 19, 7:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> that's not the way it works.... The method invalidate just puts field
> 'title' into invalid status and has no effect on save method. What you
> need to do is in your model (class) Post define method beforeSave and
> put some data control logic in there, while if control does not pass
> the method should return false. For example:
>
> function beforeValidate () {
>         if
> (preg_match('/[a-z0-9\_\-]{3,25}$/i',$this->data['Iuser']['ilogin'],
> $match) == 0){
>                 $this->Invalidate('ilogin');
>                 return false;
>         }
>         return true;
>
> }For first sight it seems awkward but it really should work like this as
> it is MVC.... Model is the one who should decide what kind of data is
> valid for it.
> 
> Hope it helps ;-)


--~--~---------~--~----~------------~-------~--~----~
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