Is it better to do that in controller or model? If yes, what are the
advantages, if not, why not? Thanks!

On Jan 18, 4:09 pm, "Dave" <make.cake.b...@gmail.com> wrote:
> Use before Save function in the model
> If(!empty($this->data))
> {
>
> $this->data['Model']['field1'] =  $this->data['Model']['field1'] * 0.55;
> $this->data['Model']['total'] = $this->data['Model']['field1'] + all your
> other fields
>
> return true;
>
> }
>
> Something like that
>
> Dave
>
> -----Original Message-----
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of Guran
> Sent: January-18-10 5:18 PM
> To: CakePHP
> Subject: Capturing Field information before to compute before saving in
> database
>
> Thanks to all who have taken the time to help out without being
> condescending or intimidating. I am a newbee and this help has encouraged me
> to keep on learning CakePHP. Once I get good I will help others on this
> forum.
>
> Now on my expense submitter i am working on - there are field1, field2, and
> field3.Hidden is the 'total' field. The user enters numerical values in
> field1, field2, and field3. Before the data is saved into the database
> field1 needs to be multiplied with 0.55 and saved back in field1. Then the 3
> fields need to be added and saved in the hidden field 'total'.
>
> I am looking for an access point to get to the fields and do my computation
> before they are saved into the database. Any suggestions and help is
> appreciated.
>
> ...guran
>
> No virus found in this incoming message.
> Checked by AVG -www.avg.com
> Version: 9.0.730 / Virus Database: 270.14.149/2630 - Release Date: 01/18/10
> 04:05:00
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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to