I created a content type with CCK for uploading a document using Filefield. In the view for displaying the node, I set as display fields the Title (not as a link), field_document (the field I created with CCK), and the Body. The problem is that the field_document field is displayed twice: once by itself as it should be, and once also in the Body field (along with the text in the Body field). It seems to me that since field_document is a separate field, it should not be displayed as part of the Body.

Here is an export of the view:

$view = new stdClass();
  $view->name = 'member_documents';
  $view->description = 'Docs available to all members';
  $view->access = array (
  0 => '3',
  1 => '4',
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Member Documents';
  $view->page_header = '';
  $view->page_header_format = '3';
  $view->page_footer = '';
  $view->page_footer_format = '3';
  $view->page_empty = '';
  $view->page_empty_format = '3';
  $view->page_type = 'table';
  $view->url = 'member_documents';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->menu = TRUE;
  $view->menu_title = '';
  $view->menu_tab = FALSE;
  $view->menu_tab_weight = '0';
  $view->menu_tab_default = FALSE;
  $view->menu_tab_default_parent = NULL;
  $view->menu_tab_default_parent_type = 'normal';
  $view->menu_parent_tab_weight = NULL;
  $view->menu_parent_title = NULL;
  $view->sort = array (
  );
  $view->argument = array (
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'nolink',
    ),
    array (
      'tablename' => 'node_data_field_document',
      'field' => 'field_document_fid',
      'label' => '',
      'handler' => 'content_views_field_handler_group',
      'options' => 'default',
    ),
    array (
      'tablename' => 'node',
      'field' => 'body',
      'label' => '',
      'handler' => 'views_handler_field_body',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'document',
),
    ),
    array (
      'tablename' => 'term_node_6',
      'field' => 'tid',
      'operator' => 'AND',
      'options' => '',
      'value' => array (
  0 => '25',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node, node_data_field_document, term_node_6);
  $views[$view->name] = $view;

I initially submitted this under Views, and was asked to submit it under FileField, since it looks like the field is being appended to the node body.

Comments

jpetso’s picture

No, filefield doesn't append the HTML to the node body, it just returns its HTML output to CCK like any other field does as well. No idea what could be happening here (maybe some option that enables the whole node view to be rendered with all its fields?), anyways I'll have to recheck this before closing it. Anyways, I don't think that filefield itself is the cause of this problem.

wonder95’s picture

OK. I had first submitted this under the Views, and was told it should go here. Should I put it under CCK?

dopry’s picture

Status: Active » Postponed (maintainer needs more info)

Do you have any custom theme functions for the node? maybe its should go under cck...

wonder95’s picture

Project: FileField » Content Construction Kit (CCK)
Version: 5.x-2.2 » 5.x-1.6
Component: Code » content.module
Status: Postponed (maintainer needs more info) » Active

No, there are no custom theme functions at all.

I'll reassign it to CCK.

kriskd’s picture

Is there any further discussion on this elsewhere? I am experiencing the same thing. I have a node type with 2 cck text fields. I created a table view and those 2 cck fields appear in their column as they should, but also in the body column. Any help greatly appreciated.

wonder95’s picture

I'm still having this problem on another site I'm working on. To answer a previous question, there are no custom theme functions being used.

It looks as though the document is being passed to the view twice. If I use list view, the document shows up twice. If I used table view, that's when I see it a second time in the body column.

wonder95’s picture

Project: Content Construction Kit (CCK) » Views (for Drupal 7)
Component: content.module » Code

OK, completely new site, and still seeing the same thing, this time with imagefield. When I display both the imagefield and the body in a view listing, I get the imagefield objects displayed twice. That seems to indicate pretty clearly that it is a Views issue, not a CCK issue. Reassigning to Views.

jpetso’s picture

Status: Active » Postponed (maintainer needs more info)

Hm... try to set the "distinct" option in your view to "Yes". Not enabling that option might be a problem for multiple-value fields because the join makes two result rows out of one. Fixes the issue?

wonder95’s picture

There is no "distinct" option. The only one close (at least in this view) is the "Group multiple values" option for the image field, and changing that doesn't make a difference. Also, whether or not there are multiple values doesn't make a difference. If I only have one image, it is displayed as part of the Body, and if I have multiple images, they are all displayed as part of the body.

jpetso’s picture

There is a "Distinct" option, just that it works for the whole view, not in the CCK context. It's under "Basic settings", on the left of your view settings page. Please look it up and try it out.

jpetso’s picture

Oh wait... Views 1? Then I might be wrong. Hm... hasn't it been there before still?

wonder95’s picture

No, I don't see an "Distinct" option, either for an individual field or the view as a whole.

wonder95’s picture

No, I don't see a "Distinct" option, either for an individual field or the view as a whole.

wonder95’s picture

Found this issue today:

http://drupal.org/node/160641

The patch works great for this.

wonder95’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)