I've got a content type called "video" with the number of items set to "unlimited"

When I click "Add another item" I get the following error which prohibits upload. I can save the node, hit edit, then add another item, however, the javascript is broken. Tested IE, and FF on Windows and Ubuntu:

An error occurred.
/content/js_add_more/video/field_emvideos
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">



  <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Quixote Center | Come Dream With Us</title>

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/sites/qc/files/favicon.ico" type="image/x-icon" />
<script type="text/javascript" src="/sites/all/modules/fckeditor/fckeditor/fckeditor.js?I"></script>
    <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/views/css/views.css?g" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/qc/files/css/css_959341d125891f9caf0bf35b4876d343.css" />
    <script type="text/javascript" src="/sites/qc/files/js/js_254a2cd2b86b20f676ba8f9f69784269.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/", "googleanalytics": { "trackOutgoing": 1, "trackMailto": 1, "trackDownload": 1, "trackDownloadExtensions": "7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip" }, "lightbox2": { "rtl": 0, "file_path": "/(\\w\\w/)sites/qc/files", "default_image": "/sites/all/modules/lightbox2/images/brokenimage.jpg", "border_size": "10", "font_color": "000", "box_color": "fff", "top_position": "", "overlay_opacity": "0.8", "overlay_color": "000", "disable_close_click": 1, "resize_sequence": "0", "resize_speed": 400, "fade_in_speed": 400, "slide_down_speed": 600, "use_alt_layout": 1, "disable_resize": 0, "disable_zoom": 0, "force_show_nav": 0, "loop_items": 0, "node_link_text": "View Image Details", "node_link_target": 0, "image_count": "Image !current of !total", "video_count": "Video !current of !total", "page_count": "Page !current of !total", "lite_press_x_close": "press \x3ca href=\"#\" onclick=\"hideLightbox(); return FALSE;\"\x3e\x3ckbd\x3ex\x3c/kbd\x3e\x3c/a\x3e to close", "download_link_text": "Download Original", "enable_login": false, "enable_contact": false, "keys_close": "c x 27", "keys_previous": "p 37", "keys_next": "n 39", "keys_zoom": "z", "keys_play_pause": "32", "display_image_size": "",

All my "add another item" buttons on my content types are likewise borked.

This may be related to this issue. However, clean urls work for me, and I pass the tests listed in comment #4.

This may be a support request, like the above issue. If so, thanks much for your help.

I recently added some rewrite rules to my .htaccess, however, removing the custom rules below has no effect on the above error.

<IfModule mod_rewrite.c>
  RewriteEngine on

 RewriteCond %{HTTP_HOST} ^haitireborn\.org$ [NC]
 RewriteCond %{QUERY_STRING} ^q=node/([0-9]{3})$ [NC]
 RewriteRule ^.*$ http://quixote.org/index.php?q=node/6%1 [R=301,L] 

 RewriteCond %{HTTP_HOST} ^haitireborn\.org$ [NC]
 RewriteCond %{QUERY_STRING} ^q=node/([0-9]{2})$ [NC]
 RewriteRule ^.*$ http://quixote.org/index.php?q=node/60%1 [R=301,L] 

 RewriteCond %{HTTP_HOST} ^haitireborn\.org$ [NC]
 RewriteCond %{QUERY_STRING} ^q=node/([0-9]{1})$ [NC]
 RewriteRule ^.*$ http://quixote.org/index.php?q=node/600%1 [R=301,L] 

 RewriteCond %{HTTP_HOST} ^(haitireborn\.org)$ [NC]
 RewriteRule !^.*node.*$ '-' [C]
 RewriteRule ^(.*)$ http://quixote.org/haiti/$1 [R=301,L]


  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

Comments

markus_petrux’s picture

Status: Active » Postponed (maintainer needs more info)

Re: "I've got a content type called "video" ..."

Is this related to the Video module? If so, the problem could be caused by that module.

More questions:

- Does the "Add more items" button work in other content types with fields such as Text, Number or Node reference?
- Could this issue be caused by any other module?
- Is there any javascript error reported?
- Anything in Drupal logs, Apache logs?

We need a step by step procedure to reproduce the problem. Otherwise, it is not possible to guess what's going on.

glass.dimly’s picture

markus_petrux,

Thanks for your careful response. I would greatly appreciate some advice as to what you think this problem might be related to, even if it's not CCK.
1. Error is reproducible on my site with "add another item" button on a content type that has just a single line text field with an "add another item" on it
2. This issue is likely not caused by the emfield module because of the above point
3. No javascript error reported through firebug
4. Ah, yes, there is an error log, thanks for asking me to check. This is no doubt quite illuminating. It appears to be a views error, but why this would appear on a node creation form, which has nothing to do with views, I have no idea.

Any idea?:

Type	php
Date	Saturday, December 5, 2009 - 5:42pm
User	_____
Location	http://x.org/content/js_add_more/test/field_test_add_item
Referrer	http://x.org/node/add/test
Message	Unknown column &#039;js_add_more&#039; in &#039;on clause&#039; query: SELECT node.nid AS nid, node.created AS node_created FROM node node LEFT JOIN term_node term_node_value_0 ON node.vid = term_node_value_0.vid AND term_node_value_0.tid = js_add_more LEFT JOIN term_node term_node_value_02 ON node.vid = term_node_value_02.vid AND term_node_value_02.tid != js_add_more WHERE (node.status &lt;&gt; 0) AND (term_node_value_0.tid = 0) AND (term_node_value_02.tid = 0) AND (node.type = &#039;field_test_add_item&#039;) ORDER BY node_created DESC LIMIT 0, 10 in /home/members/x/sites/sites/d6all/modules/views/includes/view.inc on line 765.
Severity	error
glass.dimly’s picture

Below is the views function to which the above refers. I'll gladly shift this to the views queue, but in tracking this issue down, can you tell me why a views function related to paging for the content/js_add_more is being called here? Is CCK doing this, or is this some other issue?

function execute($display_id = NULL)
...<b> cut by glassdimly</b>
        $start = views_microtime();
        if (!empty($this->pager['items_per_page'])) {
          // We no longer use pager_query() here because pager_query() does not
          // support an offset. This is fine as we don't actually need pager
          // query; we've already been doing most of what it does, and we
          // just need to do a little more playing with globals.
          if (!empty($this->pager['use_pager']) || !empty($this->get_total_rows)) {
            $this->total_rows = db_result(db_query($count_query, $args)) - $this->pager['offset'];
          }

          if (!empty($this->pager['use_pager'])) {
            // dump information about what we already know into the globals
            global $pager_page_array, $pager_total, $pager_total_items;
            // total rows in query
            $pager_total_items[$this->pager['element']] = $this->total_rows;
            // total pages
            $pager_total[$this->pager['element']] = ceil($pager_total_items[$this->pager['element']] / $this->pager['items_per_page']);

            // What page was requested:
            $pager_page_array = isset($_GET['page']) ? explode(',', $_GET['page']) : array();

            // If the requested page was within range. $this->pager['current_page']
            // defaults to 0 so we don't need to set it in an out-of-range condition.
            if (!empty($pager_page_array[$this->pager['element']])) {
              $page = intval($pager_page_array[$this->pager['element']]);
              if ($page > 0 && $page < $pager_total[$this->pager['element']]) {
                $this->pager['current_page'] = $page;
              }
            }
            $pager_page_array[$this->pager['element']] = $this->pager['current_page'];
          }

          $offset = $this->pager['current_page'] * $this->pager['items_per_page'] + $this->pager['offset'];
          $result = db_query_range($query, $args, $offset, $this->pager['items_per_page']);
<b>LINE 765 (note by glass.dimly)</b>
        }
        else {
          $result = db_query($query, $args);
        }
glass.dimly’s picture

Status: Postponed (maintainer needs more info) » Active
markus_petrux’s picture

Category: bug » support
Status: Active » Fixed

It looks like there's a view that's taking over the path used by the AHAH callback of the "Add more items" button. Hence, the problem.

In addition to this, it looks like the second argument of the path is being passed to the view as-is, This is a critical issue as it could lead to SQL Injection.

You should identify the view by inspecting the query you see in the error, or by looking at the path. Then try to identify who's using that view and disable until these issues are fixed.

Nothing related to CCK itself, so switching issue category to support request, and marking it fixed here.

glass.dimly’s picture

markus_petrux,

Thank you very much. There was a view who's path was content/.

I changed the path and the problem is gone.

Thanks for your eyes on this issue.
glass.dimly

glass.dimly’s picture

I added numeric validation on that view. I was using the default, basic validator for the view.

Though I would assume that the basic validator would filter out SQL injection. Is this not the case?

glass.dimly’s picture

Moved this issue to the views queue.

http://drupal.org/node/652666

Status: Fixed » Closed (fixed)

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

liquidcms’s picture

Status: Closed (fixed) » Active

sorry to re-open.. but... i have same error for any multi field type when i select Add Another Item i get popup window with the error:

An error occurred. 
/content/js_add_more/package-full-report/field_pkg_fsp
{ &quot;status&quot;: true, &quot;data&quot;: &quot;\x3ctable id=\&quot;field_pkg_fsp_values\&quot; class=\&quot;content-multiple-table sticky-enabled\&quot;\x3e\n \x3cthead\x3e\x3ctr\x3e\x3cth colspan=\&quot;2\&quot;\x3eFull Story Page: \x3c/th\x3e\x3cth class=\&quot;content-multiple-weight-header\&quot;\x3eOrder\x3c/th\x3e\x3cth class=\&quot;content-multiple-remove-header\&quot;\x3eRemove\x3c/th\x3e \x3c/tr\x3e\x3c/thead\x3e\n\x3ctbody\x3e\n \x3ctr class=\&quot;draggable odd\&quot;\x3e\x3ctd class=\&quot;content-multiple-drag\&quot;\x3e\x3c/td\x3e\x3ctd\x3e\x3cdiv class=\&quot;form-item\&quot; id=\&quot;edit-field-pkg-fsp-0-nid-nid-wrapper\&quot;\x3e\n \x3cinput type=\&quot;text\&quot; name=\&quot;field_pkg_fsp[0][nid][nid]\&quot; id=\&quot;edit-field-pkg-fsp-0-nid-nid\&quot; size=\&quot;60\&quot; value=\&quot;Family Dome Tents [nid:102033]\&quot; class=\&quot;form-text form-autocomplete text\&quot; /\x3e\n\x3c/div\x3e\n\x3cinput class=\&quot;autocomplete\&quot; type=\&quot;hidden\&quot; id=\&quot;edit-field-pkg-fsp-0-nid-nid-autocomplete\&quot; value=\&quot;http://capsa6/nodereference/autocomplete/field_pkg_fsp\&quot; disabled=\&quot;disabled\&quot; /\x3e\x3c/td\x3e\x3ctd class=\&quot;delta-order\&quot;\x3e\x3cdiv class=\&quot;form-item\&quot; id=\&quot;edit-field-pkg-fsp-0--weight-wrapper\&quot;\x3e\n \x3cselect name=\&quot;field_pkg_fsp[0][_weight]\&quot; class=\&quot;form-select field_pkg_fsp-delta-order\&quot; id=\&quot;edit-field-pkg-fsp-0--weight\&quot; \x3e\x3coption value=\&quot;-1\&quot;\x3e-1\x3c/option\x3e\x3coption value=\&quot;0\&quot; selected=\&quot;selected\&quot;\x3 ........

disabling the devel module and the issue goes away and i now get my added item.

views is not enabled.

shunting’s picture

I had the same problem (except my JS alert was a whole lot longer). When I turned off devel, the problem went away.

nruest’s picture

I am having a very similar problem with the "Add another item" button. When the button is clicked on any field that has the button, I get a popup display message that says, "The page at example.ca/ says: An error occurred. /content/js_add_more/war-letters/field_creator (no information available)."

I have tried all of the solutions here, but all to no avail.

1. No Views have '/content' in the path
2. Devel module - disabled, uninstalled
3. Rewrite is not a problem - http://example.ca/content/js_add_more/content_type_name/field_name_example returns: { "data": "" }

There is nothing in the Drupal log, or apache log hinting to a problem/solution.

Any ideas?

Thanks!!!

nruest’s picture

Problem found - RDF module.

RDF was appending the following to the ajax response: "xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="dcterms : http://purl.org/dc/terms/ "
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">

deltab’s picture

@nruest, did you solve it?

itsnotsohot’s picture

I am having a similar error to the above on my site. I have a content type class with fields referencing other content types (skills, people, etc.)

Now when trying to add additional items to these unlimited fields I get "An HTTP 0 error occurred. www.mysite.com/content/js_add_more/class/field_related_events (or other names, depends on the field of course). This appears to be a page level error, nothing appears in the recent log entries.

Any ideas on next steps?

Thanks!

sgwood’s picture

I had the same error i.e. content/js_add_more http error 403
when clicking on the "Add another item" button of a CCK field
set to unlimited.
The error only apeared for another user. i.e. a non-user/1 user.
The solution was to give the User Role "access content" in Permssions
under "access content". The user could then use the "Add another item" button.

The drawback of this is that users of this role will now
be able to view all Content Types when creating content.
I wanted to avoid that but this bug seems more critical.

Hope this helps someone.

My build: Drupal 6.22, Content 6.x-2.9, Views 6.x-2.12

dblankman’s picture

Priority: Normal » Major

After at least six months of working correctly, the add more now gives and error message of: An error occurred.
/europe/content/js_add_more/enveurope-metadata/field_person_first_name
(no information available).

This problem occurs with any Add Another Item regardless of the CCK content type. Unlike the first poster, saving a node does not allow adding another. Clicking on Add Another while editing a node produces the same error. This problem occurs even with administrator role.

going to the URL http://enveurope.geocatalogue.ise.cnr.it/europe/content/js_add_more/ yields
"data": "" }

any help in tracking down the source of the problem would be appreciated.

simon.fryer’s picture

Same as above. Having been working for months, and apparently out of the blue, i now get the error as described above.

I've disabled Devel, with no luck, my permissions are all good.

Any ideas?

simon.fryer’s picture

I now actually get this with a repeatable link field, so not even a content group? Again, completely randomly broken.

simon.fryer’s picture

I've had a look around, and randomly ended up in includes/common.inc at line 1421, the url() declaration.

I changed

function url($path = NULL, $options = array()) {
  // Merge in defaults.
  $options += array(
    'fragment' => '',
    'query' => '',
    'absolute' => FALSE,
    'alias' => FALSE,
    'prefix' => ''
  );

Too;

function url($path = NULL, $options = array()) {
  // Merge in defaults.
  $options[] = array(
    'fragment' => '',
    'query' => '',
    'absolute' => FALSE,
    'alias' => FALSE,
    'prefix' => ''
  );

And instead of an error, all the fields within that unlimited field get set to "____", four underscores.

This is where i end up getting stuck. Anyone got any further ideas on this?

simon.fryer’s picture

Had been a long day!

With the correct replacement for the "+=";

$options['fragment'] = '';
$options['query'] = '';
$options['absolute'] = FALSE;
$options['alias'] = FALSE;
$options['prefix'] = '';

I still get underscores, although a multigroup does add in again now, but the form is all over the place, and a random underscore in the centre, the image doesn't float right, fields are wrapping wrong etc. This happens for the added item, as well as the previous items.

And the link field just gets replaced with some underscores, including the previous entries.

Although i am on 6.x-3.x-dev - do i need to create a new bug report?

simon.fryer’s picture

FIXED IT. Holy shit.

As it turns out, apologies to module maintainers, something within our theme is 'causing it go awry.

All i've done, after literally looking at this for around 2 months on and off, here's my fix - which is solely configuration.

- Browse to 'Site configuration', 'Administration tools' then hit 'Administratio theme'. (admin/settings/admin/theme)

- Expand 'Pages' if not already

- Expand 'Custom pages'

- Add in this one line; 'content/js_add_more/*' (without quotes)

- Voila!

elgrincho’s picture

Issue tags: +js_add_more botcha

I had the same issue and just turned off one module after another. Disabling botcha-module fixed it for me.