ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-rails
ruby-rails
Re: [Rails] Save and delete buttons: POST vs. proximity dilemma
by Justin Forder other posts by this author
Sep 1 2005 9:57PM messages near this date
[Rails] Save and delete buttons: POST vs. proximity dilemma | Re: [Rails] Save and delete buttons: POST vs. proximity dilemma
Michael Schuerig wrote:

>  I'm in a dilemma: In order to keep GET requests from deleting objects, 
>  I'd like to use the button_to helper to get "something" that generates 
>  a POST request. Unfortunately, that something is a form and forms can't 
>  be nested.

button_to was a strange addition to Rails - it goes against the grain of 
HTML. A form defines the scope of content being submitted, and a submit 
control (button) represents a way of submitting it. Unless you use 
client-side script you are stuck with the single action URL associated 
with the form.

http://ppewww.ph.gla.ac.uk/~flavell/www/trysub.html

discusses the use of multiple submit buttons, with working examples.

>  I'd also like to place buttons related to the same form close to each 
>  other. At the top are some navigational buttons (links), then comes the 
>  delete button somewhere in the middle, at the bottom is the save 
>  button. Achieving this without having all of these buttons in the same 
>  form doesn't appear to be possible.
>  
>  Has anyone managed to solve this?
>  
>  The best idea I have right now is to use submit buttons in the same 
>  single form, but differentiate them by name. Then, in a before_filter, 
>  I could redirect the delete to the actual delete action. I can't say 
>  that this feels good.

Why redirect?

In Struts, you would use a DispatchAction or a LookupDispatch action to 
route to a particular method of the action class based on the value of a 
parameter in the HTTP request. LookupDispatchAction does this 
indirectly, doing a reverse lookup on the message resources used to 
define the names for the submit controls - so it it will work properly 
with a multilingual application.

Could Rails' routing handle this?

regards

   Justin


_______________________________________________
Rails mailing list
Rails@[...].org
http://lists.rubyonrails.org/mailman/listinfo/rails
Thread:
Michael Schuerig
Justin Forder
Tom Reinhart
Markus
Michael Schuerig
rails
Steve Downey
Michael Schuerig
Jarkko Laine

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved