[Agavi-Users] Best practices for "One form - multiple actions"

3 views
Skip to first unread message

Veikko Mäkinen

unread,
Nov 13, 2008, 3:59:10 AM11/13/08
to Agavi Users Mailing List
Hey,

I have a simple HTML form with several submit buttons and I need to
trigger different action from all of them and all actions need to
receive form's POST data.

I'd like to ask how people here would deal with this. So far I have two
possible solutions:

1. "Proxy action" which checks what button was clicked and forwards to
the correct action.

2. Routing hack with _POST routing source (works pretty nicely, I tried :)


Any comments on those or better solutions? All ideas will be greatly
appreciated.


-veikko

P.S. I'm developing an application that is also used with portable
devices that have zero support for Javascript techniques. This limits my
options to standard HTML + Agavi awesomeness :)

--
Veikko Mäkinen
vei...@veikko.fi
044 5910 413


_______________________________________________
users mailing list
us...@lists.agavi.org
http://lists.agavi.org/mailman/listinfo/users

David Zülke

unread,
Nov 14, 2008, 2:10:14 PM11/14/08
to Agavi Users Mailing List
I think both are valid approaches.

A proxy action as you describe it has the specific purpose of doing
this one thing for "multi-submit button forms", so it's no violation
of the MVC paradigm or anything.

In general, I guess I'd prefer that over the routing approach which
feels a tag hackier, as you said.

- David

Felix Gilcher

unread,
Nov 15, 2008, 9:51:27 AM11/15/08
to Agavi Users Mailing List
I'd go for the routing approach. While certainly both approaches are working, directing the input to the proper action feels more like a routing task to me. However, that  breaks the "one url, one resource" paradigm, but that's true for both approaches.

cheers

felix

Veikko Mäkinen

unread,
Nov 16, 2008, 2:02:14 PM11/16/08
to Agavi Users Mailing List
Felix Gilcher wrote:
> I'd go for the routing approach. While certainly both approaches are
> working, directing the input to the proper action feels more like a
> routing task to me. However, that breaks the "one url, one resource"
> paradigm, but that's true for both approaches.
>

Thank you for your input Felix and David. For the routing approach, was
there a way to configure routing sources or do I have to extend the class?

I would really like to keep the "one url, one resource" policy so just
to make sure: Can it be done somehow (using standard HTML)? I'm I
missing something here?-)


-veikko

--
Veikko Mäkinen
vei...@veikko.fi
+358 (0) 44 5910 413
http://blog.veikko.fi

Reply all
Reply to author
Forward
0 new messages