Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Posted by xjm
Problem/Motivation
Steps to reproduce
- Install 8.x Standard.
- Go to
admin/structure/views/view/frontpage/edit/feed_1
. - Edit the row style.
- Switch it to fields.
- Realize you are editing the wrong display and try to hit cancel.
- Growl at the HTML5 validation that prevents you from canceling.
Proposed resolution
?
Comment | File | Size | Author |
---|---|---|---|
#13 | views_ui-1967112-13.patch | 701 bytes | dawehner |
#9 | views-cancel-validation-followup-1967112-9.patch | 725 bytes | David_Rothstein |
#5 | core-views-novalidate-1967112-4.patch | 679 bytes | nod_ |
let_me_cancel.png | 76.74 KB | xjm | |
change_to_fields.png | 29.21 KB | xjm |
Comments
Comment #1
Dave ReidThis is why these types of buttons need to actually be links or just not input[type=submit]. Because they are buttons, they trigger the browser's built-in validation.
Comment #2
Dave ReidSee http://jsfiddle.net/GKxNR/
Comment #3
nod_the button just miss the formnovalidate attribute.
Comment #4
Dave ReidI think it's actually more than that. We're mis-using a submit button to do something that actually doesn't submit anything.
Comment #5
nod_or however it is we can create attributes with no value.
Comment #6
dawehnerI think it's fine to first just get this one in, and then maybe talk about making it a link instead.
@Dave Reid
There is indeed code executed when you click cancel.
Comment #7
XanoThis doesn't just apply to Views, but to any form in any web application. See #1834002: Configuration delete operations are all over the place for the same problem in a wider scope.
Comment #8
webchickThanks, nod_! I shall never curse HTML5 again. ;) At least until next week. :D
Committed and pushed to 8.x. Thanks!
Comment #9
David_Rothstein CreditAttribution: David_Rothstein commentedThis fix isn't really complete, since the server-side validation still runs on this form. (Interestingly, it doesn't prevent it from being submitted, but for example if you turn off JavaScript in your browser you can still see the incorrect error messages printed on the next page load.)
Using #limit_validation_errors fixes the server-side and client-side validation at the same time, and seems to me like the correct fix here.
Comment #10
XanoDavid, thanks for letting us know about this! I created #1970342: Limit validation errors for the entity form delete button to address this issue on a more general level.
Comment #11
nod_#9 is correct
Comment #12
alexpottNeeds a reroll as views ui has moved
Comment #13
dawehnerJust a rerole.
Comment #14
jibranBack to RTBC.
Comment #15
alexpottCommitted fc7897f and pushed to 8.x. Thanks!
Comment #16.0
(not verified) CreditAttribution: commentedRemoving myself from the author field to unfollow the issue. --xjm