morning mate,

you could always employ the advanced validation technique outlined in
the bakery to check for min and max length.

http://bakery.cakephp.org/articles/view/55

i use this method to check for:

- min length
- max length
- email
- uniqeness
- field confirm
- and a few others

best thing about it is you can literally check for anything you want.

let me know if you have any troubles.

cheers,
mikee

On 27/10/06, Ismael S. Kafeltz <[EMAIL PROTECTED]> wrote:
>
> I searched before open this topic, sorry if it was already made.
>
> I have this problem in early project, i don't really KNOW exactly the
> length of varchars. And Cake don't catch MySql errors to me treat.
>
> E.g: 1406: Data too long for column 'cargo' at row 1
>
> This happen when i send a string long than varchar(e.g. 70). So i have
> to treat this every field in every model/controler and truncate the
> string and/or display a red tag saying that there are erros.
>
> My suggestion is,  if Cake can mimic the databases, so it could *guess*
> what type of the field is, in this cae *varchar* of X lenght and it
> could *automatically* truncate it by default or leave to the programmer
> to decide if it is necessary do treat this manually when save datas.
>
>
> >
>

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

Reply via email to