2009/3/17 [email protected] [email protected]
I totally agree. Using a link instead of a button has several
advantages. That the user does not expect anything destructive to
happen when clicking a link, is one. And you don’t need to clutter
your controller with logic for the cancel button. The only thing you
need is a simple #link_to refering to an appropriate page.
At the risk of being contentious, I suggest that the above are
answers. It may be strictly correct to say that Cancel is an
do nothing and should not therefore be a button. Millions of people,
however, are used to seeing cancel buttons all over the place and
to throw away any data they have entered on a form and ensure that they
done no harm. Rails stresses the importance of following conventions
should therefore follow this convention and not try to enforce
unconventional ideas on the user.
In fact as I think about it, a Cancel button does take some action (at
from the users perspective, which is what matters), it discards any data
has entered into the form. The fact that this is a do-nothing action in
Rails code is irrelevant to what the user interface should be.