[Catalyst] Advice on form submission

Matt S Trout dbix-class at trout.me.uk
Thu Feb 7 07:24:12 GMT 2008


On Tue, Feb 05, 2008 at 10:42:51AM +0100, Peter Sørensen wrote:
> Hi,
> 
> I'm using Catalyst with FormBuilder and TT
> 
> I need an advice on how to handle multiple SUBMIT buttons on one form. I have a method:
> 
> sub index : Local Form {
> 	......
> 	This creates my main form 
> 	with multiple SUBMITS like
> 
> 	UPDATE
> 	DELETE
> 	ADD SUBSCRIBER
> 	....
> 
> }
> 
> What would be the most elegant solution to deal with this according to Catalyst.
> 
> I would prefer to have separate actions like:
> 
> sub delete : Local Form {
> .....

But you can't do that, because one form can't submit to multiple URIs (at
least not without javascript).

How about having one method that accepts the form and then does a $c->forward
to a 'sub delete :Action' based on which button was clicked?

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the Catalyst mailing list