When creating a new view after entering view name, view description and view type as "node" and pressing "NEXT".
Then on second page click on anything, e.g. add fields results in following error.

"An error occurred at /d6/?q=admin/build/views/ajax/add-item/testview/default/field."

CommentFileSizeAuthor
#5 views.preview.patch737 bytessun

Comments

ultimateboy’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 6.6 » 6.x-2.1
Component: drupal.module » User interface

Moving to Views project.

1kenthomas’s picture

I find the same error when the base_url in settings.php is not set to the current/a valid site URL; AJAX uses the URL from settings.php and fails.

webchick’s picture

Status: Active » Closed (duplicate)
merlinofchaos’s picture

Status: Closed (duplicate) » Active

This is probably a different error.

When you get this error I need to know if there was an error on the server. Look in your php/apache log and see.

Failing that, install firebug and use its console to look at the POST response to the ajax request and paste that here.

1.kenthomas: Does a site even work with the base_url set to something invalid?

sun’s picture

Status: Active » Needs review
StatusFileSize
new737 bytes

Was also getting an error when hitting the preview button with latest code in CVS. Dunno, whether it is actually the same as this issue.

In my Drupal logs I only had:

Undefined index: field_alias in \sites\all\modules\views\modules\node.views.inc in line 670.

In the hope to be able to debug it, I disabled AJAX/JS support for Views in the settings. Tried to preview again and: bam, completely different error, JS this time:

Drupal.Views is undefined in js/dependent.js

After fixing that with the attached patch and re-enabling the AJAX/JS support, the live previews suddenly started to work again.

Strange. But worth a fix. :)

ekes’s picture

Don't know if this is going to help any, but I'm getting this error on my dev box because of modsecurity (mod_security-2.5.9-1.fc10). At the moment I've not actually the faintest if it's a flaw in the logic of modsecurity rules or if the ajax is unfriendly.

Sample error log:-

[Sun Mar 29 12:15:16 2009] [error] [client 127.0.0.1] ModSecurity: Access denied with code 501 (phase 2). Match of "rx (?:^(?:application\\\\/x-www-form-urlencoded(?:;(?:\\\\s?charset\\\\s?=\\\\s?[\\\\w\\\\d\\\\-]{1,18})?)??$|multipart/form-data;)|text/xml)" against "REQUEST_HEADERS:Content-Type" required. [file "/etc/httpd/modsecurity.d/modsecurity_crs_30_http_policy.conf"] [line "69"] [id "960010"] [msg "Request content type is not allowed by policy"] [severity "WARNING"] [tag "POLICY/ENCODING_NOT_ALLOWED"] [hostname "video.d6.sedova.iskra.net"] [uri "/admin/build/views/ajax/display/archive/default/title"] [unique_id "Sc9KNH8AAAEAAEKJkN4AAAAE"]

The rule triggered is:-

# Restrict which content-types we accept.
#
# TODO Most applications support only two types for request bodies
#      because that is all browsers know how to produce. If you are using
#      automated tools to talk to the application you may be using other
#      content types and would want to change the list of supported types.
# 
#      Note though that ModSecurity parses only three content types:
#      application/x-www-form-urlencoded, multipart/form-data request and 
#      text/xml. The protection provided for any other type is inferior.
#
# TODO There are many applications that are not using multipart/form-data
#      types (typically only used for file uploads). This content type
#      can be disabled if not used.  
#
# NOTE We allow any content type to be specified with GET or HEAD
#      because some tools incorrectly supply content type information
#      even when the body is not present. There is a rule further in
#      the file to prevent GET and HEAD requests to have bodies to we're
#      safe in that respect.
#
# NOTE Use of WebDAV requires "text/xml" content type.
#
# NOTE Philippe Bourcier (pbourcier AT citali DOT com) reports
#      applications running on the PocketPC and AvantGo platforms use
#      non-standard content types:
#
#      M-Business iAnywhere      application/x-mal-client-data
#      UltraLite iAnywhere       application/octet-stream
#
SecRule REQUEST_METHOD "!^(?:get|head|propfind|options)$" \
    "phase:2,chain,t:none,t:lowercase,deny,log,auditlog,status:501,msg:'Request content type is not allowed by policy',id:'960010',tag:'POLICY/ENCODING_NOT_ALLOWED',severity:'4'"
SecRule REQUEST_HEADERS:Content-Type "!(?:^(?:application\/x-www-form-urlencoded(?:;(?:\s?charset\s?=\s?[\w\d\-]{1,18})?)??$|multipart/form-data;)|text/xml)" "t:none"
merlinofchaos’s picture

Status: Needs review » Fixed

Thanks, sun.

For the modsecurity issue, see: http://drupal.org/node/347753

Status: Fixed » Closed (fixed)

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