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

?

Support from Acquia helps fund testing for Drupal Acquia logo

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
FileSize
679 bytes

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
FileSize
725 bytes

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
FileSize
701 bytes

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