Thanks! I saw the title of that thread, but I thought it was to  
actually call several actions from a single submit click, so I ignored  
it....oops.

At the moment I'm more pro the routing approach, as it seems more of a  
routing thing. (Although I agree it is a touch hackier)

I think I have got the routing to work. What I did:

- Create a new routing class that extends AgaviWebRouting that  
contains a single function:

public function startup() {
        parent::startup();
        $this->sources['_POST'] = new AgaviRoutingArraySource($_POST);
}

- Add this to autoload.xml, and in factories.xml set this new class as  
the routing class

- In routing.xml add a route that has:

pattern="link" source="_POST[action]"

for a route to correspond to a submit button with name="action" and  
value="link".

This seems to work.


On 8 Mar 2009, at 06:25, Veikko Mäkinen wrote:

> Michal Charemza wrote:
>> Hi,
>>
>> Is it possible to route based on the value of a post variable? I have
>> a form with multiple submit buttons, and I think it might be better  
>> to
>> route to a different action for each.
>
> http://groups.google.com/group/agavi-users/browse_thread/thread/f55d62787c48678b
>
> Summary: You can have a cath-all action and forward to the correct
> action or you can extend Agavi's routing and add a new parameter  
> source
> (it's easier than it sounds).
>
>
> -veikko
>
> -- 
> Veikko Mäkinen
> [email protected]
> 044 5910 413
> http://blog.veikko.fi
>
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to