cast the value to (float) in the beforeValidate function of the model

On 18 Aug., 22:14, DerBjörn <[email protected]> wrote:
> Thanks a lot!...
>
> So for my example it should be the following solution:
>
> 'fieldname' => array(
>                         'numeric' => array(
>                                 'rule' => array('numeric'),
>                                 //'message' => 'Your custom message here',
>                                 'allowEmpty' => true,
>                                 //'required' => false,
>                                 //'last' => false, // Stop validation after 
> this rule
>                                 //'on' => 'create', // Limit validation to 
> 'create' or 'update'
> operations
>                         ),
>                 ),
>
> The problem i have now: If the field is null, generally the field in
> the database will be set to 0.0000 (Decimal 15,4), but CakePHP tells
> me that the column cannot be null. CakePHP is right of course. How i
> set the field to 0 automatically when the field in the form is null?
> Thanks :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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