Author Topic: Contact Ref Field munted - autocomplete works but saving set cid to single digit  (Read 1424 times)

Offline petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3656
  • Karma: 122
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Just trying the new Contact Ref Field in D7

So i put in the name in Autocomplete and it fills and replaces with cid: 624

When I saved, the field showed no data - so i Edited and saw the field was now showing cid: 6

And no there isn't a civicrm record for Id 6 - i guess if there was it would just be showing the wrong result, not a blank field

And just tested that - saved using a contact whose id = 102 and it saved as id=1 ie Inner City Arts

Might the field be set to being a single digit?

Had a snoop around in field_config table and see

data    longblob          Binary - do not edit (862 B)

Not sure i can shed anymore light on this. Anyone able to help?
pete davis : www.fuzion.co.nz : connect + campaign + communicate

Offline Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Hi,
looks like a bug, can u please file an issue regarding this.
In D6 we are using CCK api to build the contact reference field. Now for D7 we have a form api, so this module ( for CiviCRM4.X) using form api.

Rajan

Offline petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3656
  • Karma: 122
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
pete davis : www.fuzion.co.nz : connect + campaign + communicate

Offline Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Issue CRM-7836, has been fixed. There was minor issue while saving the auto-complete fields.
You can check the diff here
https://fisheye2.atlassian.com/viewrep/CiviCRM/branches/trunk.d7/drupal/modules/civicrm_contact_ref/civicrm_contact_ref.module?r1=32613&r2=33466.

Thanks,
Rajan

Offline petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3656
  • Karma: 122
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
cool - thanks rajan - will grab the code and confirm it resolves the problems we hit

pete
pete davis : www.fuzion.co.nz : connect + campaign + communicate

Offline petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3656
  • Karma: 122
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
hey rajan

just spotted that on my D7 i don't have the option to set the "Number of values:" - but I did have this in D6

Any thoughts?
pete davis : www.fuzion.co.nz : connect + campaign + communicate

Offline Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Yeah, intentionally we did that for autocomplete element. Currently unlike to the CCK API, Form API do not provide separate autocomplete field for each value ( ie Number of values). For drupal7 autocomplete field is very much compatible to the tags, so we can put multiple tags with comma (,) separator but for CiviCRM comma (,) can be the part of contact name ( also we use comma for sort name too).
So to make this thing simple for CiviCRM, I just allowed single value for each autocomplete element by considering that user will add separate autocomplete field whenever he wants multiple contact references using autocomplete field.
Any suggestion regrading this?

Offline petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3656
  • Karma: 122
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Thanks for that reply Rajan - well that certainly poses a problem for us

Use Case: a news item is created that references 3 Contacts - or 6 contacts - and we want each of those to be added to that Node so we can then show that node on their pages.

I don't want to put in eg 6 fields just in case. The previous option of being able to unset the amount and therefore allow Editors to 'add more' was great.

If D7 has shifted the goal posts on how to do this then hopefully we can find a route through this.

Certainly D7 does provide the "Number of values: Maximum number of values users can enter for this field." for other field types (just needed to clarify that for myself)

So I take it that the change in the Form API is tripping us up on this?
pete davis : www.fuzion.co.nz : connect + campaign + communicate

Offline Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14699
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x

hey pete:

if any fuzion developer(s) can take a look at this and push it forward that would be great and help the community (and your use case!!)

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.

Offline torrance123

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 2
  • CiviCRM version: 4.0
  • CMS version: Drupal 7
  • MySQL version: 5.0.91
  • PHP version: 5.3.3
I had a go at adding multiple value support for this contact field, though to be perfectly honest I'm struggling to understand the fields API and autocomplete.js.

See this issue: http://issues.civicrm.org/jira/browse/CRM-7904

Offline petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3656
  • Karma: 122
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
I have seen it with my own eyes and i declare it to be good - but will let others comment on the code - but good work getting this firing Mr T.
« Last Edit: April 12, 2011, 12:13:42 pm by petednz »
pete davis : www.fuzion.co.nz : connect + campaign + communicate

Offline Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Thanks a lot!
Patch is working great :)