Cancel is added to node forms as a link. To be more consistent with the UI, it should be added as an input button. This can be implemented by changing a line in the markup. Attached is the suggested change to line 164 of nodeformsettings.module. The resulting button is displayed consistent as the Save, Preview & Delete buttons (see attached image).

Comments

lelizondo’s picture

Status: Active » Closed (won't fix)

The cancel link feature, was added because is a new feature added in Drupal 7. There are several reasons why this is a link and not a button, the most important came from very respected users in the drupal community.

I don't expect you to agree on this issue with me, but please read these 3 comments:

http://drupal.org/node/116939#comment-1244831
http://drupal.org/node/116939#comment-1245259
http://drupal.org/node/116939#comment-1733498

However, the 'Cancel' link has 2 classes, you can use them to make it look as a button and not a link.

The 'Button vs. Link' is another issue that the UX team has to solve, not me. I'm sorry, I hate to do this, but I'll have to change this to won't fix.

mautumn’s picture

I'm sorry, but I don't care how highly respected any one is, or how many highly respected people feel the same - when it comes to UI design there is no one-size-fits-all. We don't want all websites to look the same, and I wouldn't have chosen Drupal as a CMS if UI design and style was forced on me.

The default link looks ridiculous, frankly. Yes it can be changed in CSS, but to create a UI element where 99.9% of users will want to change it - is just poor design. The default UI should cater for the vast majority usecase - whilst allowing it to be changed - for the geeks who have no appreciation or skills in UI design. You presumably have heard of convention over configuration (CoC)...?

The 'Button vs. Link' issue is extremely simple: have a global UI setting (in themes/global settings) where form trigger elements - such as submit, cancel, preview, delete, etc. - can be specified as either buttons (default!) or links - and possibly have a class associated with them?

Thanks for your useful module BTW ;)

lelizondo’s picture

I understand your point. Originally, I thought the best way to go here was the button option, but then I found the discussion I mentioned above, and I was convinced. The issue will be discussed, but not here and not by me. I really don't see a substantial difference between the two options, but one of the main reasons (according to @sun) to make it a link is because buttons:

"... trigger form validation (e.g. for required elements, but also custom validation functions)."

I'll give you an example of this. If you're editing a node and you delete all the text in a textarea that is required, you won't be able to 'Cancel' the form unless you fill the required fields with some data first. This goes against the whole idea of having a Cancel link and is hard for a user to understand.

Anyway, If you provide a patch I'll be glad to review it and if it works, I'll commit it.

mautumn’s picture

Buttons do things, links redirect you somewhere. Teckkies may beg to differ, but I think I am representing what the vast majority of ordinary users think and expect.

A Cancel button should, by hook or crook, cancel the entire form - irrespective of mandatory fields.
Just as Save should be a button, its antithesis, Cancel, should be a button. Show me any widely used commercial software that breaks this UI norm?

I think some people are letting technical "challenges" affect their UI design - something I have worked steadfastly not to do over many years of software development...

lelizondo’s picture

I'll say it again, I don't see a difference for the user/browser, the Cancel link redirects you back to the last destination (using drupal_get_destination) but not with some javascript black magic like we use to do it in 1995, is not a Back link, is a Cancel link, for the browser is a new page. Because of how Drupal is built, the button has to submit the form to do something, in this case, 'nothing', just redirect you back to the last destination. Do not blame me for this, this is NOT some crazy decision I made, if you look around, in Drupal, when there's cancel option, is always a link, not a button. Again, It wasn't me who made this..

The only difference is for the themer, who has to implement some CSS to make the Cancel link look like a button.

When you say that the 'Cancel button' should cancel the form irrespective of mandatory fields, again, that's another discussion you should be having with the Drupal developer team, I think this is not possible in D6, at least not with significant amount of work that I and many others think is not worth it.

As I said before, this discussion is not with me but you have two options:

1. Provide a patch, I'm not investing a second on this.
2. Discuss your points of view where the original discussion is taking place, with the right people, not with me.

jdln’s picture

Could you provide some help providing a theme override / custom module, etc which would allow the cancel link to be a button instead?
Thanks