Views does not allow you to save a view if there are validation errors on one of its displays, which is a good thing.

However, if a display exists with validation errors, and you are deleting that display, Views should allow you to save it, because from a user's perspective it seems superfluous to correct errors on a display which will be deleted.

Comments

dawehner’s picture

Currently all errors on all displays are merged together so it's somehow not possible to distinct between display-only and actualy form errors.

You have to know that the validation stopping is done via a drupal api function.

merlinofchaos’s picture

I think when validating we can test the 'removed' flag and simply not validate displays that aren't going to be saved.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

I thought of just display the errors but your idea is better, but this is already done and works :)

    foreach ($this->display as $id => $display) {
      if ($display->handler) {
        if (!empty($display->deleted)) {
          continue;
        }

I tryed this out by adding a filter content: type which filters by a type which got removed after configuring the view. This executes a validation error. If you "delete" the display the error goes away.

So i guess you have validation error on the not deleted display

alberto56’s picture

Title: Allow saving of a view when there are validation errors on a deleted display » Allow saving of a view when there are validation errors on the master display
Status: Postponed (maintainer needs more info) » Closed (duplicate)

Hi, here is the exact situation where this does not work.

- Create a new view, with only a page.
- Add the filter "Content: type", with no type selected (this causes an error for the page display)
- Add a new display (Block, for example).
- Come back to the original page display, and edit its Content: type field, setting "Article", and overriding it (Only for this display)
- Now delete the second display
- Saving does not work, giving you the error "No valid values found on filter: Content: Type"

The underlying structure of the view, at this point, is as follows:

- The "master" display (which, by default, is hidden from the user) contains validation errors.
- The only undeleted display is fine (no validation errors).

Therefore, this is a duplicate of #1345934: default display being hidden makes it possible to be unable to save a view with validation errors.