Closed (won't fix)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.0-rc9
Component:
General
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Jul 2006 at 10:56 UTC
Updated:
25 Nov 2008 at 11:22 UTC
Jump to comment: Most recent file
Comments
Comment #1
RayZ commentedDidn't realize this was a general CCK issue. If so, I believe I would call it a bug. Here's my description of the same issue, specifically for the date field http://drupal.org/node/72085.
Comment #2
marcoBauli commentedComment #3
solipsist commentedThis is clearly a bug, empty fields contain:
<br><br class="clear">So knowing that, you can find a way around it.
Comment #4
bluecobalt commentedHas any progress been made in regards to this problem?
Comment #5
marcoBauli commentedyes, the code below will print a field only if it has a value (if is not empty):
this is an example for a cck field called "ticker_id" (thanks Brakkar ;). It is intended to be used in the content-type phptemplate file.
Reverting title since "empty" and "NULL" do not mean the same thing (read more here about this).
Can it be considered fixed at this point, or is not properly a CCK solution?
Comment #6
marcoBauli commentedmaybe was more a support request, to be considered fixed now ;)
Comment #7
ashtonium commentedI'm setting this as a bug, though it may be related to the bug about the content module not storing NULL values: http://drupal.org/node/85929
marcob: your code only hides empty fields if the input type is plain text. If there is any filtering going on, the empty field value gets modified to:
<br />\n<br clear="all" />and is still displayed.At the moment, in order to universally hide blank fields, you can use this code as your field.tpl.php file: (file is also attatched to this post)
This still won't hide empty number fields since those are apparently stored in the database as a 0 rather than a NULL value, and hiding a 0 would also hide entered values of 0 along with the empty fields.
I've marked this as Code Needs Work because I'm sure there's a better way of doing it, and also also because it is just a temporary fix until the storing NULL values bug gets fixed.
Comment #8
karens commentedThe break in empty fields is actually coming from your filters. For instance, if you have image_asst enabled, empty fields will get <br class="clear"> added to them, but that will disappear if you turn off image_asst. Most of the time I get at least a <br /> in an empty filtered field no matter what filters I am using.
The workaround mentioned here (testing for '<br />' or whatever the filters you have installed do to empty text) is the only way you can handle it. CCK is actually doing what it ought to do, allowing the filters to process the text and there's no way around that when you're using 'filtered text'.
Comment #9
spiffyd commentedNot sure if this is a related issue so I won't start a new thread...
Basically, empty HTML containers for empty CCK Image fields are being outputted when used with Views. Is there any way to hide these empty containers (via CSS) or prevent the code from showing up?
Thanks!
Comment #10
yched commentedPlease open a separate issue, describing your exact issue.
Following up on a 2-year-old closed issue is not a good idea.