You have to name the buttons differently from each other!
Then look for the name in the array keys $this->params['form'].
Do you processing depending on which key you find.
Enjoy,
   John

On Mar 3, 10:14 pm, echo419r <[email protected]> wrote:
> I have a form that when a user submits, it saves their data and emails
> their leader a notification.  I want to add a new submit button to the
> bottom of the form that, when clicked, will just save the data and not
> email their leader.
>
> I've done some research and I've tried the following:
>
> In the view:
> $form->submit(__('Save', true), array('name' => 'saveType', 'value' =>
> 'Save'));
> $form->submit(__('Submit for approval', true), array('name' =>
> 'saveType', 'value' => 'Email'));
>
> In the controller:
> if($this->params['form']['saveType'] == 'Save') {
>     // do save functions}  else if ($this->params['form']['saveType'] == 
> 'Email') {
>
>     // do email functions
>
> }
>
> However, I get this message:
> Undefined index:  saveType
>
> And when I debug($this->params) this is all I get in the form key:
>  [form] => Array
>         (
>         )
>
> Is there some alternate way of having 1 form but 2 different submit
> buttons where clicking one button saves the data and clicking the
> other saves and emails the data?

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