[FLOW3-general] Edit Form with two seperate target actions

John Small flow3.tiny69 at net-con.net
Thu Sep 27 20:28:53 CEST 2012


Hi,

not tested in this specific way,

you could name your submit-buttons then you have the value of the 
clicked button in your action-method.
then in the action-method you can choose where to go with different 
redirect-calls depending on that value.

To use the additional value in your action method just add it in the 
header of the method:

public function updateAction(Someobject $someobject, $buttonname = 
'default') {
     ...

     if ($buttonname ...)
         ...redirect('here');
     else
         ...redirect('there');
}


if you have to provide an object for the action method you want to 
redirect to add it to the redirect call, e.g.

     $this->redirect('show', 'Controllername', NULL, array('someobject' 
=> $someobject));


HTH


Am 27.09.2012 15:11, schrieb Jan Greth:
> Hey Folks,
>
> I have an simple Edit-form like the one autogenerated by the FLOW3 CLI.
> Looks like this:
>
> /*********************************************************************/
> <f:form action="update" object="{location}" name="location">
>   <ol>
>     <li>
>       <label for="title">Title</label>
>       <f:form.textfield property="title" id="title" />
>     </li>
>
>     <li>
>       <label for="street">Street</label>
>       <f:form.textfield property="street" id="street" />
>     </li>
>
> [...]
>
>     <li>
>       <f:form.submit value="Save and back"/>
>     </li>
>   </ol>
> </f:form>
> /*********************************************************************/
>
> But now I have the problem that I would like to have two send buttons.
> One for "Save and back" and one just for "Save" (User stays on page)
>
> How would you implement it?
>
> I had thoughts of writing a new action - but Action is set in form 
> head not in button...
>
> Bye,
> Jan

-- 
kind regards



More information about the FLOW3-general mailing list