Using anchor for cancel in a Form

Hi all, Looking for best practices when it comes to submitting a form
and canceling a form in Rails.

I am leveraging a CSS dynamic that gives hover over and an embedded Icon
to all buttons in my application so most buttons are anchors in my
application. Artclie on the implementation:

Looking for advise on this:
In order to keep these nice looking buttons I have to submit the form
with an anchor and cancel with an anchor tag. Is it okay to have the
cancel button just leave the page and go to a path or should I direct it
to the controller and then go to the Path ? What is the best practice?
Am I missing some kind of clean up I should be doing or is leaving the
page acceptable ?


  • form_for @activity, :url => { :action => “update” }, :html => {:id
    =>“aform”} do |f|
    = f.error_messages
    = f.label :title
    = f.text_field :title
    = f.label :artifact
    =, %w{HLD SRS IA})
    = f.label :milestones
    =, %w{M5 M4 M3})

    %a{:href => “javascript:{}”, :onclick =>
    “document.getElementById(‘aform’).submit(); return false;”}
    %img{:src =>“/images/img/icon-check.png”, :border => “0”}
    = link_to image_tag(“/images/img/icon-delete.png”,
    :border=>0)+“Cancel”, activity_path