As mentioned briefly in this comment, when working with a text field (the body) in my view, I'm getting the following error:

Notice: Undefined index: format in _text_sanitize() (line 319 of /public_html/modules/field/modules/text/text.module).

This also is most likely the reason that I'm seeing tags when viewing a textfield in my view. For example, instead of html formatted output, I'm seeing something like

<p>my text shows here, including the paragraph tags</p>
Files:
CommentFileSizeAuthor
#4133.91 KBahimsauzi
#2316.93 KBhedel
#2116.9 KBhedel
#195.48 KBneoglez

Does this happen only when aggregating a field?

Honestly, I'm still figuring out what "aggregating" a field means :) The fields are grouped and the field does say "Aggregation Settings" next to it...so yeah, I suppose it's aggregated.

Aggregating means taking the results of several fields in a group and running an aggregation function on them, such as sum or count or average. It's required when 'aggregation' setting is checked in the advanced settings.

Can you describe how to reproduce the problem easy?

This would really help to fix the problem.

Dereine: I had a fields based view where I used the "Group by" functionality. Then, as merlin mentioned, you choose the 'aggregate' checkbox under advanced to see this behavior.

I unchecked aggregate and the error went away...my tag problem also was resolved.

+1

Happens when I enable aggregation while "Content: Body" is a displayed field.

Hello all,

I have the same error.

Notice: Undefined index: text_processing in _text_sanitize() (Zeile 319 von /is/htdocs/wp1191537_HP1AJE6ECC/www/metropolnews-mrn/modules/field/modules/text/text.module).
Notice: Undefined index: value in _text_sanitize() (Zeile 319 von /is/htdocs/wp1191537_HP1AJE6ECC/www/metropolnews-mrn/modules/field/modules/text/text.module).

Everything went fine until i added a Taggingfield to my Block-View and did some rearranging.

And after I did some Work with the fields, like Rewrite Output and things like that - the Error-message disappeared.

Note: I got same error after adding computes field to the content type and view.
Changing the field formatter to plain text the notices disappeared.

The same error. Subscribe.

subscribe

subscribe

By isolating the field that was causing the error, due to the lack of that field I was able to correct this.

I went into views, edited the field's properties, and saved. It is now supplying the needed index, so the errors go away.

In my case this was a field that was once a text field, then was changed into a list. I am fairly certain that I did the view edits that caused this after it became a list, but hopefully that will help someone else resolve the root cause of this.

In my case this was a field that was once a text field, then was changed into a list

Actually no wonder that this caused an error :)

I am getting this error, and I did not convert a text field to a list, it is simply happening when I have a body field in a view that has aggregation turned on.

Seems to actually happen when choosing "value" as the group by characteristic for body field.

FileSize
5.48 KB

it is simply happening when I have a body field in a view that has aggregation turned on.

Seems to actually happen when choosing "value" as the group by characteristic for body field.

Based on this info i've tried to reproduce the problem and i couldn't.
Could someone preovide an export?? (see, for example the file att.)

I created a View that pulled several fields from a content type, which worked great. Then I had to change one of the fields in the content type from a free-text field to a text selection list, using the same field name.

After that, I was seeing this error everywhere the View was displayed.

I deleted the original field from the View and added it back in (even though it was the same name and was still a text field) and the error was gone.

Not sure if that helps you identify the problem, but it fixed my issue.

FileSize
16.9 KB

Here is a print screen of the problem: http://imageshack.us/photo/my-images/502/viewserror.jpg/

and attach the export of the view

Ataxia is right. I delete the field and add it again to the view and the problem is gone.

FileSize
16.93 KB
I deleted the original field from the View and added it back in (even though it was the same name and was still a text field) and the error was gone.

Ataxia is right, I deleted the field I change and add it again to the view and the problem is gone.
Here is attach the export of the fix view and the problem was here:
$handler->display->display_options['fields']['field_cena']['type'] = 'text_default'; and now look like:$handler->display->display_options['fields']['field_cena']['settings'] = array(
'thousand_separator' => ' ',
'decimal_separator' => '.',
'scale' => '2',
'prefix_suffix' => 1,
);

I hope this can help for understand where is the problem and how to fix it.

Greetings

I had the same problem after adding the date field to the article content type and it wouldn't go away. I do have a backtrace which will hopefully help. Here's the result:

Notice: Undefined index: format

27  Line: 21,  File: /index.php,  Function: menu_execute_active_handler
26  Line: 518,  File: /includes/menu.inc,  Function: drupal_deliver_page
25  Line: 2438,  File: /includes/common.inc,  Function: drupal_deliver_html_page
24  Line: 2550,  File: /includes/common.inc,  Function: drupal_render_page
23  Line: 5505,  File: /includes/common.inc,  Function: context_page_build
22  Line: 248,  File: /sites/all/modules/context/context.core.inc,  Function: execute
21  Line: 222,  File: /sites/all/modules/context/plugins/context_reaction_block.inc,  Function: block_get_blocks_by_region
20  Line: 316,  File: /sites/all/modules/context/plugins/context_reaction_block.inc,  Function: block_list
19  Line: 352,  File: /sites/all/modules/context/plugins/context_reaction_block.inc,  Function: _block_render_blocks
18  Line: 834,  File: /modules/block/block.module,  Function: module_invoke
17  Line: 794,  File: /includes/module.inc,  Function: call_user_func_array
16  Function: views_block_view
15  Line: 639,  File: /sites/all/modules/views/views.module,  Function: execute_display
14  Line: 1132,  File: /sites/all/modules/views/includes/view.inc,  Function: execute
13  Line: 53,  File: /sites/all/modules/views/plugins/views_plugin_display_block.inc,  Function: render
12  Line: 1011,  File: /sites/all/modules/views/includes/view.inc,  Function: execute
11  Line: 992,  File: /sites/all/modules/views/includes/view.inc,  Function: _post_execute
10  Line: 583,  File: /sites/all/modules/views/includes/view.inc,  Function: post_execute
9  Line: 613,  File: /sites/all/modules/views/modules/field/views_handler_field_field.inc,  Function: set_items
8  Line: 770,  File: /sites/all/modules/views/modules/field/views_handler_field_field.inc,  Function: field_view_field
7  Line: 934,  File: /modules/field/field.module,  Function: _field_invoke_default
6  Line: 375,  File: /modules/field/field.attach.inc,  Function: _field_invoke
5  Line: 198,  File: /modules/field/field.attach.inc,  Function: field_default_view
4  Line: 210,  File: /modules/field/field.default.inc,  Function: text_field_formatter_view
3  Line: 264,  File: /modules/field/modules/text/text.module,  Function: _text_sanitize
2  Line: 319,  File: /modules/field/modules/text/text.module,  Function: _drupal_error_handler
1  Line: 2172,  File: /includes/bootstrap.inc,  Function: _drupal_error_handler_real
0  Line: 88,  File: /includes/errors.inc,  Function: _drupal_log_error

in _text_sanitize() (line 319 of /modules/field/modules/text/text.module).

I've changed this to active as I suspect I've tracked down at least some of variables that are the root cause of this bug but if you still can't duplicate it let me know what I can do next.

I tried deleting then adding the content body field as mentioned above and no effect but left the aggregate settings and body field at their defaults. I then looked a little closer and saw that it defaulted grouping on "value" which didn't make any sense to me since value would be the body text (at least in my case it makes no sense). I then changed the grouping from the default to Item ID and the error went away (I assume Item ID's are unique so there was no grouping that could happen).

I then looked at the field side and noticed that formatter was set to default. I changed it to plain text, changed the grouping back to value in the on the aggregation side and no error. I think what this is saying that somehow the body text is being left without a formatter when it's on default and therefore the grouping when set to value doesn't have enough information to work with since there is no formatter to go through and this lack of information goes all the way through to where the error happens.

Does this work for anyone else?

I tracked this down to the $entity variable in set_items() in views_handler_field_field.inc on the content body field (line 764). This$entity variable gets passed (at least in part) all the way through to _text_sanitize() . The variable in _text_sanitize() that causes the error looks like this for the body field:

array(1) {
["value"]=>
string(143) "<iframe frameborder="0" height="1920px" scrolling="no" src="http://mysite.com" style="overflow-y: auto;" width="100%"></iframe>"

Two more items that I just noticed just:

• The error doesn't show up from the view preview, only on the properly rendered page
• If I use the either of the other two formatters (summary/trimmed) the error returns and an additional error as well (below)
Notice: Undefined index: format in text_field_formatter_view() (line 279 of modules/field/modules/text/text.module).

I can confirm that I did the same thing in Ataxia's (#20) comment: I created a text field, made a *page* view with the text field, changed the field to a list with the same machine field name and didn't edit the view.

When I removed and re-added the field the problem went away.

It might be specific to page views, if that helps narrow down how to reproduce it. Not sure.

Are you sure this is a Views related problem? I have a custom content type that after moving from D6 to D7 (running on 7.12) started giving this error: Notice: Undefined index: format in _text_sanitize() (line 319 of ....modules/field/modules/text/text.module). The content type has nothing to do with views, but does have quite a few custom fields.

When I first migrated into D7 I had quite a few problems with these custom fields - fatal errors on the integer fields and I resaved each of them which seemed to clear all that up. But now I get the undefined index: format in the _text_sanitize function.

So, not sure if that adds any pertinent info to the problem but I'll start watching this thread. Thanks for any insights.

Grouping by value on a text field when using aggregation triggers the problem for me - text field html tags are escaped in both preview and final render, and I get the text format error when the view is rendered. This is a block view, so it's not restricted to pages.

Grouping by entity ID fixes it.

I had the same issue. Grouping "body" field in the view by "Entity ID" fixed it.

@Toddv: Regarding,

"Are you sure this is a Views related problem?"

Have a look at the backtrace in #24, it's clearly going through views. My install also is a clean 7.x install. No upgrading from D6.

Ah, right you are.

Same here:

Notice
: Undefined index: format in
_text_sanitize()
(line
319
of
C:\drupal\modules\field\modules\text\text.module
).

Notice
: Undefined index: format in
_text_sanitize()
(line
319
of
C:\drupal\modules\field\modules\text\text.module
).

After aggregating body field. #30 doesn't work for me. How ever changing body field Formatter to Plain Text fix it. Off course its not a solution.

Just met the same problem with aggregating field. Subscribe.

 Status: Active » Fixed

If you use aggregation you should better change the aggregation setting of the field and add the format field there as well. This should fix the issue here.

 Status: Fixed » Needs work

I agree that the problem seems to be solved through enough people saying what's happening for the issue to be known and understood.

However, shouldn't there be either a code change or at the very least some documentation added to the module somewhere so that when you turn on aggregation you are either programatically locked out from doing the wrong combination of options or at least there is some text to tell you what you need to do right?

To me posting the error in drupal.org or a web search engine to pull up this page to learn what you have to do is not exactly a fix. Even if it's not feasible to change the code wouldn't some warning or info text somewhere when you first turn on aggregation be reasonable and plausible solution?

"Warning, not selecting the appropriate text filter could result in "warning" messages in your log table".

or something like it.

When this happens with any text field, simply changing the format from "default" to "plain text" solved this problem.

@kannary100, Yes, I think we have established that changing the filter from default solves it. But like I said in #36, something that tells people this when they turn on aggregation instead having to search to find out what's going wrong would be appropriate.

I have a View with six attachments and I get exactly the same error messages whenever any one of these attachments returns a result. It is fine when no results are returned and if more than one attachment returns a result then I get more than one set of error messages as you might expect.

However, I am not aggregating anything on any of these attachments or, indeed, on the main Page. Changing the format has no effect (most of my fields are hidden anyway).

my problem also was caused by the aggregation of the field.
1 field gave error - field Content: body. so i set another Aggregation Group column, by default there was "format", so i select "Entity ID", thats all.

 Issue tags: +text format, +unsanitize
FileSize
33.91 KB

In my case it was an aggregation settings for the actual field that solved it. I used a text field in the view that for some reason the default aggregation settings did not included the text format. That obviously offended (at rightfully so) the _text_sanitize function.

To solve this: select the Entity ID on the Group Column menu and tick on the Group Columns (additional) Entity ID, Value and Format options.

Thanks for #30 and #41 - this fix my problem!

Here's a fix that worked for me. You will need to turn on the "Always show the master display" option at /admin/structure/views/settings

I ran into this issue when I set Use aggregation to Yes in a view with multiple displays. I had applied aggregation to all displays, instead of just narrowing it down to only the one display.

Once I turned on aggregation, this error was appearing in every single display for the view. I went back into the view, turned off aggregation for all displays. I went into the fields, and made sure that these were different than the master display. In this case, I opened the title field and saved it with This page: override selected.

I then reactivated aggregation only on the display that needed it, making sure that the master display did not have aggregation activated. When done properly, the Aggregation settings link will appear in the display's field, but not in the master display.

I saved the display, and that did the trick.

I recommend to select "Entity ID" in the Group column of the Aggregation Settings of each of your fields.

Note: This can result in unexpected results but it's the only possible way to bypass the issue.

Tricky issue and it still in the latest versions of core & Views.

I figured out a solution which might not be ideal but helped me:

Add at line 266 & 320:

$item['format'] = isset($item['format']) ? $item['format'] : 'full_html'; same here. solved by remove field from views and add it again For me worked when I edit the "Strip HTML tags" checkbox on "REWRITE RESULTS" for the field. @frizi (#45): Those lines you mentioned to add. To what file should they be added? In my case I was trying to format th field as an URL using "Output this field as a link " in the Rewrite results section of the options. Selecting "Plain text" as formatter solves the issue for me. ¿Maybe the default selection of formatter is not loading correctly? Adding the format and value to the aggregation setting for my body field as described in #35 worked for me. When in views, editing a field, the option "Place a colon after the label". When it is unchecked, the error goes away for me. Just in case someone else gets into the same trouble: In my case this same problem happened when after a created a View I modified the content type of one of the fields (from text to node reference), then I started getting the message. Solution: In the View remove the modified field and add it again. After that the problem went away. Greetings, Eduardo After i dig my head more and i got the solution. Its mainly because of views misconfiguration. If you use Global: custom text and add the html code directly into the text box, you will get this error. Solution: Instead of using text box to add html code, use rewrite result and select Output this field as a link then add the link code and select strip html. You will get rid of this issue. @GaneshKumar Can you see if it's still happening when you set the filter to "Full HTML"? I'm not exactly sure if that's fixed it for me or not, but curious what it does for someone else... (For the Global: custom text box) Yeah, this issue is NOT specific to views... If you upgraded from D6 -> D7 and converted fields with option radio/buttons, you might run into this error. The "Content Migrate" module may not do a very good job of updating the field in the database... I ended up having to manually update the database and fix the affected fields in the field_config_instance table. WooHoo! Just figured out how to fix it! (Ok, for my use-case situation...) Been pulling my hair out the last two days trying to track down exactly what was going on since it wasn't directly a View related issue but I have a feeling my solution might be the cause of other's who ARE experiencing it on views... As I mentioned before, I narrowed it down to my "Option Checkbox / Radio" fields. Looking into Devel, led me to look into the database. That led me to realize that the way the database was storing the field "Format", wasn't ever updated in the D6->D7 migration. D6 stored the format as "text_default" and D7 stores the format as "list_default" (For the radio buttons at least...) If you aren't using a view on the page receiving the error, proceed below for my step by step solution. I recommend opening a second page that does show the errors, so you can test it again after doing the following steps. (In a nut shell, change the "Format" on the content display tab to "Key" then back to "Default" for every display that uses a list field.) What I ended up having to do was: 1) Go to the default display of the content type. At the bottom you can choose to "Customize Display Settings" for the various displays (Teaser, RSS, Search Index etc.) 2) Enable each and every display. (Updating it in the default doesn't replicate to the rest :-/) 3) Start with the Default display and find ALL of your List(text) fields and change the format from "Default" to Key then save that display. 4) Next change them all from Key, back to Default. This will update the database to store it as the correct format. 5) Proceed with each of the remaining displays. 6) Test your page getting the errors. If that doesn't fix it, you might load up Devel and see if you can figure anything else out... Hope that helps! I had a similar problem, when the body field was added to fields list of a view, then the relationship was added, and the grouping turned on. After that in the preview section I saw that the content of the body field in preview data were not turned into html: i saw BR's there, etc. I deleted the body field from the field list, and added it again. Is asked me whether i want to aggregate over it and i agreed. It asked if I wanted to add some more fields (subfields of body field?) and I included format field as well. The problem disappeared.  Version: 7.x-3.x-dev » 7.x-3.7 Same issue with Drupal 7.19 / Views 7.x-3.7 solution #11 posted by e5sego worked for me... #11 Changing the field formatter from default to plain text the notices disappeared. Thanks. I reproduced the same error in a slightly different way (unless I missed something): • Add a field in a content type • Create a view that will include that field • In the content type fields, delete the field and add a different one with the same name In this way, when displaying the view, I get the particular error. To solve it, I followed #15 suggestion to simply update the view's field. Hope it helps. This went away for me when I changed the taxonomy term's description field Aggregation settings > Group Column from Value to Entity ID I had deleted a field, to change it from text field type to integer. Removing the field and adding it again fixed the error. I couldn't even get it working by changing something at the taxonomy field/widget etc. I had to build the view from scratch and then it worked. Thanks for all your posts; I had exactly this problem, and reading what others had done was enough to help me fix the symptom (though it would of course be nice to fix the source of the problem). I had a new content type with many fields and this error appeared. I found out which field was causing the problem by putting the following line just before the line 319 of the function _text_sanitize(): dsm($instance);

When I knew the field causing the problem, I simply deleted it and recreated it. This solved the problem.

Thanks for your help. I had this issue and I solved it using #35 solution. It worked perfect for me.

 Issue summary: View changes

Had this problem with a default body field. Drupal 7.26 and Views 7.x-3.1 #41 solved the issue.

#41: To solve this: select the Entity ID on the Group Column menu and tick on the Group Columns (additional) Entity ID, Value and Format options.

#20 did it for me

I have the same problem:

Notice : Undefined index: text_processing dans _text_sanitize() (ligne 319 dans /var/www/drupal/modules/field/modules/text/text.module).
Notice : Undefined index: value dans _text_sanitize() (ligne 319 dans /var/www/drupal/modules/field/modules/text/text.module).

Is appearing for each row of my view (which is a simple view: displaying all full node of a particular content type)
This happens after I deleted a text field in my content type and add a tag field with the same name.
I could not solve this...
I have "shaked" the view as much I could (changing row=field , removing the filter on the content type, showing the teaser,...) but the errors are still there

I was having the same trouble with the Body field, then attempted #20. It didn't work at first, but then I went back into my Body field's aggregation settings and changed the Group Column from "Value" to "Entity ID." Now it's perfect.

#68 solved issue for me!

+1 for #68

I am getting this issue with a programmatically created node in the VIew where text format is set to null.

Also, I am not using aggregation.

Looks like there are thousands of Drupal sites with this issue now

#68 helped me too. Thanks!

Like others above, my problem was changing the type of a node field from text to date but not updating views. The symptom was one watchdog log message Notice: Undefined index: text_processing in _text_sanitize() (line 319.. for each row of view displayed.

Found it using #63, first checking the number of messages correspond to the number of views query rows and using the debug which showed a null parameter on one field. Went to views, removed offending field, saved, added field (of new type). Worked. Thanks to all !

Exactly like #73: changed the type of a field but kept the same field machine name (which was already being used in some views). Views found the field (and displayed it correctly) but was confused about the field type apparently. Deleting that field from your view and adding it once again solves it indeed.

#73 (@charlied) was spot on and #74 (@knalstaaf)'s solution exactly for me. Thanks.

Hi All,

This issue has been open since 2011! Does anyone else think it's about time we close it?

We have established without a shadow of a doubt what the cause is -- settings that are incompatible with aggregation. Going back to #36 does anyone have a good recommendation on how to tell people ahead of time what's going on so that we could one day close this issue?

I vote the easiest path for the short term which would be a notice when you first turn on aggregation to the effect of:

"Warning: Some combinations of settings can cause aggregation to throw an error and due to the nature of aggregation not all can be foreseen. If you are seeing errors since using aggregation see issue Undefined index for hints on settings for aggregation.

Not a perfect fix but quick to do because it won't require anyone to dig deep into the code to try and predict when an error will be thrown.

I ran into a similar problem, the root cause was that the aggregated text columns didn't include the 'format' field, so the _text_sanitize() function didn't work correctly.

What I did to fix it was go into the aggregation settings for the text fields and check off "format" under "Group columns (additional)", that fixed the problem.

So maybe the logic for that widget should be smart enough to automatically add the "format" item for text fields?

#41 solved my problem.

#41 solved the issue also afor me

After reading #77 which is what #41 says but without the "Entity ID" and "Value" fields included, I solved the issue like this:

Aggregation type: "Group results together"
Group column: "Value"

That way the field_name_field_format is included in the SELECT clause of the query and _text_sanitize() does not complain anymore.

 Version: 7.x-3.7 » 7.x-3.x-dev Status: Needs work » Active

There is no patch on this yet so status can remain Active. I agree enough people seem to be running into this that maybe a code solution would be better.

 Issue tags: +undefined index

#35 worked for me. Thanks