I use a taxonomy argument in two views:
Views #1:
- Argument: "Taxonomy: Term"
- Validator: Taxonomy term / Argument type: Term name
- Action to take if argument does not validate: Display emtpy text
Views #2:
- Argument: "Taxonomy: Term"
- Validator: PHP Code
- Action to take if argument does not validate: Display emtpy text
If the taxonomy argument is valid / not there everything works great.
If the taxonomy argument is not valid, I get the empty text message and the error
Notice: Undefined index: nid in views_handler_field_term_node_tid->pre_render() (Line 80 of ./sites/all/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc).
Comments
Comment #1
DeepBlack CreditAttribution: DeepBlack commentedSame error: taxonomy argument not valid =>
Notice: Undefined index: nid in views_handler_field_term_node_tid->pre_render() (Line 80 of publicweb/sites/all/modules/views/modules/taxonomy/views_handler_field_term_node_tid.inc).
Comment #2
dawehnerpre_render shouldn't be runned for empty views.
Comment #3
SvenLu CreditAttribution: SvenLu commentedHi!
Just a quick Question. Is this patch for Views 7.x or 6.x?
I have this problem with Views 7.x. Just asking because you changed the Version "7.x-3.x-dev » 6.x-3.x-dev"
Comment #4
dawehnerThe real bug behind this issue should be solved in 6.x-3.x first and ported later.
The patch was created against 7.x, but the changes was in a file which shouldn't have changed.
You can mark this issue as "needs work" if the patch didn't applied.
Comment #5
DeepBlack CreditAttribution: DeepBlack commentedWorks great - no more errors.
Thanks
Comment #6
MJH CreditAttribution: MJH commentedI have the same problem with Views 7.x-3.x-dev.
Is the mentioned patch already in the newer devs or do I have to use the patch?
Comment #7
dawehnerBefore asking whether this patch is for 7.x-3.x, too you should
a) Test the patch with 7.x-3.x
b) If the patch applies you could mention it
If the patch doesn't apply you could mention it too.
Comment #8
MJH CreditAttribution: MJH commentedPatch tested with Views 7.x-3.x-dev from Mar-14:
Error message "Undefined index: nid in views_handler_field_term_node_tid->pre_render()" is gone.
No other negative effects found.
Comment #9
Apfel007 CreditAttribution: Apfel007 commentedwhen will be this patch committed?
Comment #10
dawehnerAssign to review.
Comment #11
RYL CreditAttribution: RYL commentedHi,
I'm also having this problem and will apply the patch.
However, for all new users of this module, do we have a date to get this patch committed ?
How can we help to make this happen ?
Thanks
Comment #12
dawehnerJust in general there is no a HARD date when something is commited but sure you can help.
You know there are SOOO many issues in views, a notice, which is not an php error, isn't that mission critical :)
Comment #13
dynamicdan CreditAttribution: dynamicdan commentedI love the idea that it's a notice and harmless but I also love the idea that it's easy to fix... => quick win?
This is the only patch I have to manually merge to ensure our system doesn't break due to the 'notice'. It's an incredibly bad experience for users/admins to see 'error looking' messages whenever editing or creating a view.
Note: this also happens on the latest dev version (7.x-3.x-dev).
Comment #14
johnvI have tested this patch on 7.x-3.x-dev and it works fine.
Works for #13 , #8 and #5 ==> RTBC
@dynamicdan #13: at admin/config/development/logging (path for D7) , you can set the watchdog-messages that appear on screen - so you can avoid notices showing up.
@dereine #4: IMO bugs should be fixed against latest version ,and then backported? You state otherway around.
Comment #15
dawehnerSadly the patch doesn't apply for me to 6.x-3.x anymore.
Comment #16
joshmillerI don't have time to setup a clean diff, but here's how to manually fix this based on the patch supplied by deriene in #2
Note: Tested and works marvelously with views-7.x-3.1
1) Open up /views/includes/view.inc
2) Search for the lines
"// Initialize the style plugin.
$this->init_style();"
3) Add this statement directly below:
if (!empty($this->result)) {
4) Search for "$this->display_handler->output = $this->display_handler->render();"
5) Add this curly bracket directly above
}
6) Hit reload on your view. If you get a white screen of death, you haven't put the if statement in the right spot. Try again.
Josh
Comment #17
astro87 CreditAttribution: astro87 commentedThanks joshmiller, it's working for me
Comment #18
johnvThe patch from #2 is outdated with latest -dev.
I am not sure if it is necessary anymore, given the fact that is is from March 2, 2011.
Comment #20
joshmillerThis appears to be fixed in 7.x-3.x -- can't reproduce the error and I find more logic here than last I saw...
see Line 985 in views/includes/view.inc:
I believe this fixed the original issue.
Comment #21
Apfel007 CreditAttribution: Apfel007 commentederror still there
Comment #22
SilviaT CreditAttribution: SilviaT commentedSame here, choosing as Action to take if filter value does not validate Display content of "No results found"
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedHave the same bug in 7.x-3.5.
The strange thing is though I didn't have it at first.
It only happened during development and testing when I shut down a few modules keeping a lean install, as well as going from pretty URL's to normal URL's and deinstalling PathAuto and Global Redirect. I have also been configuring panels. As well as building additional panes within the same view.
It's not much to go on, for now, but maybe it rings a bell with someone, and we can hopefully find the common denominator(s) for this bug.
Comment #24
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #25
Anonymous (not verified) CreditAttribution: Anonymous commentedBy the way I get the error on line 88 instead of line 80. Let me post the error code here:
By the way does it strike anyone else as odd that it's complaining about the node id (nid) on a taxonomy term page?
That could mean it may have something to do with a field or relationship that is looking up information for a node.
Edit:
Additionally the error doesn't occur on:
Edit 2:
Edit 3
Edit 4
Possible cause found. It appeared to be one of the fields or a custom rewrite within a field in the master display of the view that was also being used on some other content panes, that may have been the cause of the problem. The error message has dissappeared. I'll try to reproduce the error. This may take a while.
Comment #26
Anonymous (not verified) CreditAttribution: Anonymous commentedMy bad. Switched accidentally.
Comment #27
Anonymous (not verified) CreditAttribution: Anonymous commentedQuestion
Did anyone have this happen on a cloned view? Where the original view does not give the error but the cloned one does? Or are people having this on original views as well?
Comment #28
dianacastillo CreditAttribution: dianacastillo commented#16 This works for me . Is it going to be commited?
thanks
Comment #29
pbusch CreditAttribution: pbusch commentedI created a patch based on #16.
I have tested the patch for 7.x-3.x-dev and 7.x-3.5.
Comment #30
danharper CreditAttribution: danharper commentedI seem to be getting this error message when trying to write a custom validation function for an exposed taxonomy term in a view.
The error is the same as above and having googled it this is the only thread I can find with the same error and the above patch doesn't solve on views 7.x-3.7+22-dev
Thanks
Comment #31
axiom3279 CreditAttribution: axiom3279 commentedGetting same error on taxonomy term view page. I looked at patch #16 and for version 7.x-3.8 the if statement in view.inc is not necessary. A simple check took care of this issue.
Comment #32
eelkeblokAlthough this is the less intrusive approach, dawehner explicitly says in #2 that pre_render should not run at all for empty results.
The patch from #29 still applies to the latest release (and solves the issue for me), so setting to RTBC.
Comment #33
eelkeblokI ran into issues with #29 on a site. Views pages that did not return any results turned into white pages. I haven't fully debugged yet, but the result for the menu callback was null with the patch, resulting in the entire page to not be generated.
Comment #34
eelkeblokActually, #29 does *not* implement #16. #16 says to put the line
$this->display_handler->output = $this->display_handler->render();
outside the if statement, thus executing this line also when the result set is empty. The patch puts this line within the if(), hence the empty page callback result, presumably. Attached is an alternative patch that puts the render-line outside the if. It solves my issue.Comment #35
Gixxernutter CreditAttribution: Gixxernutter commented+1 on #34 - worked for me - thanks
Comment #36
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 3 year old patch in #34 to view.inc applied cleanly to the latest views 7.x-3.x-dev
Comment #37
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedVersion change only
Comment #38
sathish.redcrackle CreditAttribution: sathish.redcrackle at Red Crackle commentedAttached patch for views 7.x.3.22
Comment #39
preethy211 CreditAttribution: preethy211 commentedi am getting this error on exposed_validate() function and not pre-render() function
Notice: Undefined index: field_study_project_tid in views_handler_filter_term_node_tid->exposed_validate() (line 340 of /var/www/html/sites/all/modules/contrib/views/modules/taxonomy/views_handler_filter_term_node_tid.inc).