CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • showBlocks array item not in .tpl
Pages: [1]

Author Topic: showBlocks array item not in .tpl  (Read 4074 times)

SteveM

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 3
    • OpenConcept Consulting, Inc.
showBlocks array item not in .tpl
February 05, 2008, 01:40:44 pm
Using CiviCRM 1.9.12432 ...

I am creating Contact and Contribution custom data groups and fields using the API: it seems that in every case this results in javascript throwing 'showBlocks array item not in .tpl =' errors. These errors do not appear for custom data created via the UI.

Previous searches have suggested that special characters might be a problem (not the case) or that clearing caches and templates might help (also not the case).

Ideas? Anyone else had this happen?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: showBlocks array item not in .tpl
February 05, 2008, 03:14:33 pm

could you compare the db records of the custom group for a group created via the API vs the UI. that way, you could potentially isolate whats causing the error

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

SteveM

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 3
    • OpenConcept Consulting, Inc.
Re: showBlocks array item not in .tpl
February 06, 2008, 07:56:59 am
Aha! The API is not creating a name from the supplied label. The records created via the API have Name = NULL in the DB.

I note that the API docs present examples of custom fields being created by passing a label without a name:
http://wiki.civicrm.org/confluence/display/CRMDOC/Object+Properties+and+Custom+Data+APIs

SteveM

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 3
    • OpenConcept Consulting, Inc.
Re: showBlocks array item not in .tpl
February 06, 2008, 08:12:33 am
Clarification and confirmation: the JS problem arises because the custom groups are created with name=NULL. Forcing in a name on creation solves the problem. Neither fields nor groups are being created with names via the API.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: showBlocks array item not in .tpl
February 06, 2008, 11:39:55 am
Steve - Do the 1.9 APIs allow you to pass in a name= parameter, and hence this is a problem with the documentation? If so, would be great if you could update that page.

If the APIs don't handle the 'name' in 1.9 - it would be most helpful if you could retest this with 2.0. If the problem is still there, please file an issue with a patch to the code. Thx!
Protect your investment in CiviCRM by  becoming a Member!

SteveM

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 3
    • OpenConcept Consulting, Inc.
Re: showBlocks array item not in .tpl
February 07, 2008, 06:42:07 am
Using name='' solves it. I'll update the wiki.

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: showBlocks array item not in .tpl
April 14, 2008, 06:48:56 am
I ran into this error message, but within the core functions (i.e. not using APIs for custom work). However the bug was the same.

I created a set of custom fields for participants. When I view a contact and seek to register them for an event, the event reg form opens. I select the event, then select participant type (which then matches the custom field set). I get the "showBlocks array item not in .tpl" error message. The custom field set appears and is accessible, no problem. The issue is with the show/hide block function.

I went into my database and found that in civicrm_custom_group the "name" field for this custom group was a NULL value. Now, I did have other custom groups that had been created and the name field was auto-assigned, no prob, including another participant set.

I've not been able to nail it down, but it would appear that there is some set of criteria or circumstances such that the custom group creation does not always auto-create the "name" of the custom group.

I remember that when I did some upgrades from 1.9 to 2.0, there were several custom groups for which I had to manually create a value in the name field. So I think this issue is a carryover from older versions.

-Brian

support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: showBlocks array item not in .tpl
April 14, 2008, 06:54:43 am
Quick follow-up (I had an idea what the problem might be after my last post) --

The problem has to do with the length of the custom group title. The "name" field is auto-generated based on the group title defined in the GUI. If the group title is long, the script trims it when creating the associated custom group table. I suspect it's supposed to do the same thing for the "name" field in civicrm_custom_group, but can't handle the title length and so it breaks and leaves the value null.

Short group titles work fine.

I'll test on sandbox and report back.
-Brian
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: showBlocks array item not in .tpl
April 14, 2008, 07:04:31 am
Reproduced on the Joomla sandbox.

Go to a contact, register them for any event, select "Attendee" participant type, error appears.
(I created a custom group with a really long group title.)

Jira: http://issues.civicrm.org/jira/browse/CRM-2982
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • showBlocks array item not in .tpl

This forum was archived on 2017-11-26.