In admin.inc - function views_ui_preview(), the code that should show you details as to why the preview won't render does not show the actual error. The drupal_set_message is not seen.

While using the 'views_data_export' module and adding data_export display to a simple view of nodes, I had not set the path setting for the data_export display and was only seeing the generic 'Unable to preview due to validation errors' message in the preview area.

I figured out why the error was occurring but wondered why there was not a more informative error message. Tracing the code quickly led me to the function views_ui_preview() and I could see that $error was set to a very informative error message but not displayed.

This is likely due to the way these messages are rendered and the theme does not have access to the new message. The error is not even displayed if you force a page refresh.

Maybe this logic should either log the error or append the error to the $preview value.

    foreach ($errors as $error) {
      drupal_set_message($error, 'error');
    }
    $preview = t('Unable to preview due to validation errors.');

Comments

MustangGB’s picture

Status: Active » Closed (outdated)

Closing this as outdated, feel free to re-open with updated details if it's still a problem in the latest release.