I am currently working on a form that will have two buttons: Compute
and Add.

What I wanted to do: click Compute button->computed values will
populate fields->click Add button(submit form)

So when I click on my Compute button, the salary will be passed on a
component I made and will be processed to come up with computed values
to populate some fields before I submit the form. The compute button
is working well but when I click on the add button, I am getting
errors "Notice (8): Undefined index:  compute [APP\controllers
\deductions_controller.php, line 67]" and "Warning (2): Cannot modify
header information - headers already sent by (output started at D:\wamp
\www\cake\cake\basics.php:111) [CORE\cake\libs\controller
\controller.php, line 640]"

here's my controller code for the buttons:
        if($this->params['form']['compute'] == "Compute")
        {
                $this->data['Model']['field'] = $this->component-
>function($salary). '.00';
                $this->data['Model']['field'] = $this->component-
>function($salary). '.00';
                $this->data['Model']['field'] = $this->component-
>function($salary). '.00';
        }
        elseif($this->params['form']['add'] == "Add")
        {
                $this->Model->save($this->data);

                $this->Session->setFlash('success message',
'success');
                $this->redirect(array('action' => 'view'));
        }

Also, if you notice the . '.00' I have in my Compute button code
above, I'm having problems with formatting the computed values in a
money format so for now, I'm concatenating the result with the decimal
point. But I want to do it properly. I've tried to use the number
helper and I've searched through the net about this, but I can't get
enough information.

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