Hi Josey,

You are welcome!
I am happy to contribute something here, after I am getting so much here myself!

Anja

-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von Josey
Gesendet: Dienstag, 25. November 2008 15:28
An: CakePHP
Betreff: Re: 1 form, multiple actions


Anja, wanted to get back with you.

I modified my action based upon your recommendation and it worked swimmingly!

Thanks for your help.

On Nov 25, 1:53 am, "Liebermann, Anja Carolin"
<[EMAIL PROTECTED]> wrote:
> Hi Josey,
>
> I had the same problem. I needed two submit buttons with different actions 
> behind it. What I did:
>
> In the view:
>
> </fieldset><?
> echo $form->submit('saveandleave', array('div'=>false, 
> 'name'=>'saveandleave',  'value'=>'saveandleave')); echo ' '; echo 
> $form->submit('onlysave', array('div'=>false, 'name'=>'onlysave',  
> 'value'=>'onlysave')); echo $form->end();?></div>
>
> In the controller it goes to one action, but forks there depending on the 
> parameter:
>                         if ($this->Mymodel->save($this->data)) {
>                                 $this->Session->setFlash(__('data 
> saved', true)); //here comes the fork:
>                                 if($this->params['form']['save'] == 
> 'saveandleave') {
>                                         
> $this->redirect(array('action'=>'index'));
>                                 } elseif($this->params['form']['save'] 
> == 'onlysave') {
>                                 ....
> Hope that helps
>
> Anja
>
> -----Ursprüngliche Nachricht-----
> Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im 
> Auftrag von Josey
> Gesendet: Montag, 24. November 2008 23:40
> An: CakePHP
> Betreff: 1 form, multiple actions
>
> Is it possible to have multiple controller actions in one form?
>
> What I'm trying to do is this:
>
> I have a form that lists all my posts, if you're logged in as admin you get a 
> checkbox beside every post.
> You would select these checkboxes to perform certain actions.
>
> As of right now I have it pointing towards my delete action to remove 
> multiple rows in the database at once. Works like a charm.
>
> What I struggle with is the fact that "Publish/unpublish" will also be an 
> option alongside "Delete" so how do I tell the form what action the button is 
> supposed to take?
>
> Thanks to all.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to