Hi,
when i write a new message and click on cancel, i got the error: "There are no valid recipients." and Subject etc.
When i click on cancel i don't care that there are no infos. I thought the button should delete the message.
Thank you
strauch
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | privatemsg.module_cancel_link_v3.patch | 1.31 KB | berdir |
| #6 | privatemsg.module_cancel_link_v2.patch | 936 bytes | B00N |
| #5 | privatemsg.module_cancel_link.diff | 1.07 KB | berdir |
Comments
Comment #1
naheemsays commentedYeah, just tested.
Go to messages/new and without entering any info, just click cancel.
You will get an error message:
Comment #2
berdirWhat should the cancel button do ? Just empty the form or going back to the previous site ?
Comment #3
naheemsays commentedIt should go to the messages page. I had a look around core and nowhere similar (create content etc) has a cancel button. maybe just remove it?
Comment #4
strauch commentedi don't need the button, if i don't want to write the message i close the window or click on another menu link or something else. It is propably possible that someone press the wrong button and the text is gone, so i would remove the button.
Comment #5
berdirMaybe adding a simple Cancel-Link similar to the "Do you really want to delete that"-form that core uses.
Here is a simple patch that does change this.
Comment #6
B00N commentedI've tested the patch (an 6.x-1.0-rc2) and it works.
it would be nice to have a #id to style with CSS. So i changed the following line in the patch from post #5:
'#value' => l(t('Cancel'), 'messages'),to
'#value' => l(t('Cancel'), 'messages', array('attributes' => array('id' => 'edit-cancel'))),Can you use this patch for the next release?
Comment #7
tstoecklerTo my mind, it doesn't really make sense to confirm deletion, because you haven't saved anything before, you have just entered some stuff and are leaving the page, without ever having touched the db. And similar things are nowhere to be found in Drupal core. Visit node/add/story, enter something and click on any menu item. No deletion there, so why add it here?
The only logical thing IMO is to delete the cancel button altogether, it has no functionality as of now and it is not needed for anything -> kill it!
Comment #8
berdirThere is a similiar issue open for Drupal core, http://drupal.org/node/116939.
I think adding a Cancel link would be a good idea, both Facebook ( grey "Cancel" button) and Gmail ("Discard" button) are also having something similiar.
Think about users who are not familar with browsers, there are many users who don't know/use the browser back button and a cancel link does not take up much space.
Attached is a updated patch which does use $_REQUEST['destination'] if set.
Comment #9
tstoecklerI still don't understand it what case this is actually needed, but well, I guess it's nothing critical as long as the button is fixed.
Comment #10
quicksketchThis looks great to me too. I agree the "Cancel" link/button is good to include. I'm glad to see we're using a link rather than a button to fit with Drupal convention.
Comment #11
litwol commentedCommited! thanks alot.
Comment #13
Anonymous (not verified) commentedI know that this issue is closed but for the sake of others looking I simply used drupal_get_messages('error'); drupal_goto('somewhere/else'); for the action of the $form_state['clicked_button']['#value'] == 'Cancel'. The drupal_get_messages('error') will clear the validation error message queue. Both the drupal_get_messages('error') and the drupal_goto('somewhere/else') calls need to be in the _validate callback.
Comment #14
litwol commentedThe above solution is kind of bad (sorry!), i advise not using it.
Comment #15
Anonymous (not verified) commented@litwol: Do you have a better solution? Saying it is bad without offering advice of something better is like throwing stones at the leper instead of trying to offer him a healing salve. I did research how others have resolved this and all I found
was a linkwere suggestions to use a link instead of a form button.Comment #16
litwol commentedWhat is wrong with a link? If you want to make it look like a button then all you have to do is style the link look like a button. Perhaps place an image there or something.
Comment #17
Anonymous (not verified) commentedThere is nothing wrong with a link styled as you suggest if you know what the default button looks like for every browser that is possible to be used. You still don't give a reason as to what is wrong with what I suggested; why is it such a poor method? Sure, the verification code still executes and the errors are being cleared; but, it does give the desired result. I do find it a fault of Drupal to not provide a way to skip the validation for a '#type' => 'button' or to even provide a '#type' => 'cancel' that defaults to skipping the validation.