Posted by xjm

Problem/Motivation

Steps to reproduce

  1. Install 8.x Standard.
  2. Go to admin/structure/views/view/frontpage/edit/feed_1.
  3. Edit the row style.
    row_style.png
  4. Switch it to fields.
    change_to_fields.png
  5. Realize you are editing the wrong display and try to hit cancel.
    let_me_cancel.png
  6. Growl at the HTML5 validation that prevents you from canceling.

Proposed resolution

?

Files: 
CommentFileSizeAuthor
#13 views_ui-1967112-13.patch701 bytesdawehner
PASSED: [[SimpleTest]]: [MySQL] 55,976 pass(es).
[ View ]
#9 views-cancel-validation-followup-1967112-9.patch725 bytesDavid_Rothstein
PASSED: [[SimpleTest]]: [MySQL] 54,407 pass(es).
[ View ]
#5 core-views-novalidate-1967112-4.patch679 bytesnod_
PASSED: [[SimpleTest]]: [MySQL] 54,207 pass(es).
[ View ]
let_me_cancel.png76.74 KBxjm
change_to_fields.png29.21 KBxjm
row_style.png21.39 KBxjm

Comments

Dave Reid’s picture

This 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.

Dave Reid’s picture

nod_’s picture

the button just miss the formnovalidate attribute.

Dave Reid’s picture

I think it's actually more than that. We're mis-using a submit button to do something that actually doesn't submit anything.

nod_’s picture

Status:Active» Needs review
StatusFileSize
new679 bytes
PASSED: [[SimpleTest]]: [MySQL] 54,207 pass(es).
[ View ]

or however it is we can create attributes with no value.

dawehner’s picture

Status:Needs review» Reviewed & tested by the community

I 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.

Xano’s picture

This 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.

webchick’s picture

Status:Reviewed & tested by the community» Fixed
Issue tags:+VDC

Thanks, nod_! I shall never curse HTML5 again. ;) At least until next week. :D

Committed and pushed to 8.x. Thanks!

David_Rothstein’s picture

Status:Fixed» Needs review
StatusFileSize
new725 bytes
PASSED: [[SimpleTest]]: [MySQL] 54,407 pass(es).
[ View ]

This 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.

Xano’s picture

David, 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.

nod_’s picture

Status:Needs review» Reviewed & tested by the community

#9 is correct

alexpott’s picture

Status:Reviewed & tested by the community» Needs work

Needs a reroll as views ui has moved

curl https://drupal.org/files/views-cancel-validation-followup-1967112-9.patch | git a
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   725  100   725    0     0   8805      0 --:--:-- --:--:-- --:--:-- 10357
error: core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php: does not exist in index
dawehner’s picture

Status:Needs work» Needs review
StatusFileSize
new701 bytes
PASSED: [[SimpleTest]]: [MySQL] 55,976 pass(es).
[ View ]

Just a rerole.

jibran’s picture

Status:Needs review» Reviewed & tested by the community

Back to RTBC.

alexpott’s picture

Status:Reviewed & tested by the community» Fixed

Committed fc7897f and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary:View changes

Removing myself from the author field to unfollow the issue. --xjm