I posted this bug earlier, but apparently I did this in the wrong place...
I have a view that adds a limiter on the end of the taxonomy/term/%1 core view. If the url has lds_clipart appended, it displays items of only two content types: image and a custom type called documents. I am trying to use the empty field block to display a place holder image when an image is not displayed (only applies to the document content type in my case). I have put the following code in the Empty Text area for the Images field:
<img align="left" src="http://www.jennysmith.net/sites/all/themes/newswire/images/lds-printable.png">
The following link shows the problem clearly:
http://www.mormonshare.com/taxonomy/term/2393/lds_clipart
The first item in this list happens to be a document. The empty field image shows up perfectly as expected.
Next are some images -- just right.
Next follows a couple more documents. Now the empty text field image data is not displaying.
I think there might be a problem with a flag or something that is supposed to tell whether the empty field applies or not. It *could* explain why oxford-dev can't show images using the empty text option either, if the first item in his/her lists does not call for the "empty" field to be called.
---
On my previous post, a user suggested that this was being triggered because it was not empty; however, the image field *is* empty for a document and should trigger the image field's empty text, as it does the first time views steps through the sequence, right?
Views is working like this in the list:
document = images is empty, trigger empty text;
image = image field is not empty, do not trigger empty text;
document = images is not empty, do not trigger empty text.
Comments
Comment #1
JennySmith commentedSorry I wrote that last bit wrong. It should read:
Views is working like this in the list:
document = image field is empty, trigger empty text;
image = image field is not empty, do not trigger empty text;
document = image field is empty, do not trigger empty text. <== error occurs only after empty text is NOT triggered by the previous item in the list. I think something about the empty field is not being reset when views loops through to the next item.
Comment #2
sethcohn commentedJenny, as I said on the previous posting, looking at your example, I see content in Doc #2, not an empty value.
I'd suggest playing with the view and ensuring it really is empty when you expect it to be. I'm guessing it's not empty, it's got a value you didn't think it did.
One easy way to tell, is clone the view, then use a different method (ie instead of table, use list, or vice versa) of dumping the data, so you can look at the results.
Anyone have a good debug method to help here???
Comment #3
JennySmith commentedSeth, my friend, I gotta whine a little here. Your comment dismissing my bug report has surely caused people to ignore what I'm saying. All you did was look at the generated HTML. Didn't listen when I said that there isn't an image field in type document. You didn't try to reproduce the error. When newbies report errors and are dismissed by old hats, the community is weakened.
Here's a table view using the cloning method Seth suggested showing that the field is empty:
http://www.mormonshare.com/for_seth/2393
Since the last post, we've:
1. Updated Views (bug still present)
2. Dumped the data using the Views SQL query. Verified there is no data in the "node_data_field_imagetype_field_imagetype_value" field for items of content type Document.
Here are some links that demonstrate the bug: the original link, document first. Notice that the empty text field -- the html displaying the pink printables image -- shows on the first listed item. And here are results with documents listed after images first. On this one, the empty text field is never triggered, because the first item in the list is not empty. Here's that last view in table format.
These links show that after node_data_field_imagetype_field_imagetype_value is not empty in a list, the empty field text does not display.
.
I hope this makes things clearer. DH is looking at the code, but it will take him a good while to figure out the problem. Hopefully someone can help us track it down.
Comment #4
merlinofchaos commentedUnfortunately, that's all Views looks at too. If there is HTML generated in the field, Views will not trigger the empty text.
Question #2: Can you reproduce this with core fields? The Views submission guidelines ask you to submit issues with fields provided by modules against the module providing the field. I can see where you might be looking at a bug where the image field is accidentally retaining data from the previous row. That said, imagefield.module contains the code responsible for doing that. So even if this bug exists, the Views issue queue isn't actually the right place to put it.
This is especially true of something like imagefield, where the data is almost certainly fetched via secondary query.
Comment #5
JennySmith commentedAh -- thanks. That makes sense. I will keep looking.
Comment #6
JennySmith commentedI can duplicate the error in core! Well, at least I think I'm using core fields.... Is CCK core?
I've at least found the flag that's causing the problem. Here's how to see it. Click the following link:
http://mormonshare.com/core_test/8559
and then sort on the "lesson manual id" field TWICE to get the thing to sort the empty field first. You'll see that the empty text "Show me if empty" only shows IF that item is the first item in the list.
I'm pretty certain that the flag that's causing the error is the "Link this field to its node" checkbox.
I had to use CCK in order to show the problem b/c I couldn't find any other fields that used that flag that I knew I could set as empty.
What I did:
1) Created 3 nodes. Tagged them with a unique term. I used blog and story (article) types.
2) Added a text cck field to each content type that I did not set to required.
3) Made a table list view that was sortable to show only nodes with my term.
4) Ticked the "Link this field to its node" checkbox on the CCK field and also entered some empty text.
5) Viewed the
Even when the field is empty, sometimes the "link this field to it's node" flag is putting a link into the field. I'm sorry I can't tell you if this a views flag or something supplied by CCK and images. Non-core type fields, I mean.
I haven't tested using only one content type. My 3 nodes are of 2 types. Don't know if it matters....
I'm leaving now, but maybe DH will be on IRC later if someone can chat with him about it. He's Root at our house. I'm the wannabe. :)
Comment #7
merlinofchaos commentedNo, CCK fields aren't actually core, they have their own handlers. Core fields would be things like Node: title and such.
Comment #8
sethcohn commentedCongrats, a nice test to show the bug.
Yes, that clearly is incorrect, since sorting shouldn't change value, so something must be broken, if order matters for it to appear.
Earl? If she's seeing it in a variety of cck fields (text and images), sounds like a big enough bug to me.
Comment #9
Chris Gillis commentedI am also experiencing this error.
On the first item (the only one with a value) the content outputs this:
<a href="/node/296">My Node Title</a>. Then on every subsequent row on THAT PAGE, the content outputs this:<a href="/node/296"></a>an empty link to the node of the first result. If I go to the second page, the content returned is actually an empty string for each row (allowing me to display my empty text).Please note that the field on which I am experiencing this error is the node title of a related node. The error only occurs when I choose "Link this field to it's node".
I'd love some idea of where to start looking, so I can go snooping...
Comment #10
Chris Gillis commentedSolution! Tick the "Hide if empty" box. Problem instantly solved. Jenny, if you can confirm this works for you we can close this issue.
Comment #11
JennySmith commentedSorry I fell off the Earth for a while there.... anyway....
Chris, you're my hero! This solved the problem!!!
Might I suggest a change to the help text in the GUI for help users who might also experience this issue?
The current text for Empty Text in the Views GUI reads: "If the field is empty, display this text instead."
Perhaps it could read instead: "If the field is empty, display this text instead. Tick the "Hide if Empty" box if you are experiencing problems with this field."
The text under Hide if Empty should also probably change to "Do not display anything for this field if it is empty. Note that the field label and empty text field may still be displayed. Check style or row style settings to hide labels for empty fields."
Thanks again, everyone.
Comment #12
iamjon commentedI'm closing this from a lack of activity. Please feel free to reopen and submit a patch.