On Mon, Mar 16, 2009 at 6:58 PM, PP Junty
<[email protected]> wrote:
>
> andrew, the problem i see is that you depend on the label of the button.
> if a user wants to change the label of one button, let's say to "Abort",
> then it requires another method for this particular button.
> using
>
> <%= submit_tag 'Any Label', :name => 'cancel' %>
>
> and
>
> def check_for_cancel
>  unless params[:cancel].blank?
>    redirect_back_or_default.......
>  end
> end
>
> you can avoid that.
>
>
> Andrew Porter wrote:
>>
>> I use a filter -
>>    before_filter :check_for_cancel, :only => [:create, :update]
>>
>> and a method
>>
>>    def check_for_cancel
>>      if params[:commit] == 'Cancel'
>>        redirect_back_or_default.......
>>      end
>>    end
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

I just add a link next to the submit tag labelled 'cancel' with a link
to an appropriate page.
Technically a button should be used for an action while cancelling is
technically the absence of an action.

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to