Details
-
Type: Patch
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.4.4
-
Fix Version/s: 3.4.5
-
Component/s: CiviCampaign
-
Labels:None
Description
Interview survey respondents doesn't do autocomplete on contact reference field. After nearly losing what's left of my mind I figured out the problem is simply that autocomplete looks at the 'id' of the main field & the 'name' of the hidden field. The name of the hidden field is expected to be the same as the id of the main field + id but this isn't the case:
main_field['id']= field_73368_custom_121
main_field['name'] = field[73368][custom_121]
id_field['id'] = field_73368_custom_121_id
id_field['name'] = field_[73368][custom_121_id]
I can see the syntax
When I looked at the code I found that the discrepancy is caused around line 1495 of CRM_Core_BAO_UFGroup
if ( $onBehalf )
{ $name = "onbehalf[$fieldName]"; }else if ( $contactId && !$online )
{ $name = "field[$contactId][$fieldName]"; }else
{ $name = $fieldName; }So, I tested to see if the problem also occurs with onBehalfOf form & it does. Which suggests that maybe the fix should be made in autocomplete.tpl (to get it use id on both fields rather than expect id & name to be the same) or on onBehalfOf to not use [ in the name syntax - I am less sure the correct approach now I know the problem is not limited to survey component.
As an aside - there appears to be some cruft in the buildProfile for im that I think is obsolete now we have the on behalf of form.