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 »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • CiviCRM CCK Contact Reference auto-complete text field not working
Pages: [1]

Author Topic: CiviCRM CCK Contact Reference auto-complete text field not working  (Read 5918 times)

hanschri

  • Guest
CiviCRM CCK Contact Reference auto-complete text field not working
June 16, 2009, 06:11:16 am
When typing a CCK Contact Reference name into the auto-complete text field cck field type, the auto complete function adds [cid:#] to the end of the name where # is the contact id of the user referenced, like: "Doe, John [cid:2]". When attempting to save node, drupal outputs this error: "[contact reference fieldname here]: found no valid post with that title.". If I erase the [cid:#] from the field and save I get no error, and the contact is referenced correctly.

If I edit the node after saving, I will once again have the [cid:#] appended to the name and I will not be able to save.

I'm running civiCRM in a separate database in multilingual mode (not sure if that matters). CCK version 6.x-2.2, 2.3 and latest dev has same issue. Is this a CiviCRM issue or a CCK issue?

Can some genius please tell me what to do? ;)
Thanks!

locomo

  • I’m new here
  • *
  • Posts: 4
  • Karma: 2
Re: CiviCRM CCK Contact Reference auto-complete text field not working
June 23, 2009, 01:38:36 pm
i had the same problem

i'm just starting to understand how this module works and i'm not sure what the intention was behind doing it this way but i made a bandaid fix on my installation

i changed this line in the file "civicrm_cck.module"

from:
$matches["{$row['title']} [cid:{$id}]"] = '<div class="reference-autocomplete">'. $row['rendered'] . '</div>';

to:
$matches["{$row['title']}"] = '<div class="reference-autocomplete">'. $row['rendered'] . '</div>';

i also found that this field only auto-completes for contacts of type "Individual" but not "Organization" which is what i need to reference - this can be changed around line 628 in the same file

kennedyusa058

  • Guest
Re: CiviCRM CCK Contact Reference auto-complete text field not working
June 24, 2009, 07:15:12 pm

Cheers and we look forward to your Forum Favourites selections!  :D

pret auto

hanschri

  • Guest
Re: CiviCRM CCK Contact Reference auto-complete text field not working
June 26, 2009, 01:32:17 am
Thanks, locomo, you genious you! Works like a charm. 

mariagwyn

  • I post frequently
  • ***
  • Posts: 149
  • Karma: 4
  • CiviCRM version: CiviCRM 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.2.14
  • PHP version: 5.0.91-50-log
Re: CiviCRM CCK Contact Reference auto-complete text field not working
November 05, 2009, 03:46:06 pm
locomo,

your fix works, as long as the node it not edited.  Once edited, the CID is replaced, and the error returns.  Is there someplace else in the module to modify?  I did a scan, but I am not seeing anything obvious.  But I am not a coder.

siffring

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
Re: CiviCRM CCK Contact Reference auto-complete text field not working
November 23, 2009, 12:49:08 pm
Yeah, I'm seeing the same thing.

With this fix, when you create the node and do the auto complete, it pulls up Last Name, First Name (as it should).

When you go back and edit the node you'll see that the value of that field has been changed to Last Name, First Name [cid:123].

If you try to save this node without changing anything you'll get the error, "CiviCRM Contact: found no valid post with that title."

If you manually delete the [cid:123] from the field you can save without any errors.

So, the question is where is that [cid] getting set and how do we prevent it or hide it when editing the node?

I searched through the civi module, but can't seem to find where this is happening. Does anyone else have any ideas?

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: CiviCRM CCK Contact Reference auto-complete text field not working
November 23, 2009, 03:32:38 pm

you can take a look at (and potentially fix the code) here: drupal/modules/civicrm_cck/civicrm_cck.module


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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • CiviCRM CCK Contact Reference auto-complete text field not working

This forum was archived on 2017-11-26.