Autocomplete-Select options not saving/displaying properly
Overview
Autocomplete-Select custom fields are not properly displaying when that field is viewed, but does show the selected option in edit mode.
Reproduction steps
- Create a custom field of type ‘Autocomplete-Select’
- Select an option for that field on a contact/contribution/ext. and Save
- Note that the response does not display when viewing the field on that record
- Click Edit and note that the selected option does display
Current behaviour
Custom fields of type ‘Autocomplete-Select’ are not displaying when in View mode, but do display when editing that field on a record.
The id of the OptionValue is what is getting saved for the field, instead of its value:
Getting the custom field from the example contact’s record:
[
{
"Auotcomplete_save_test.Favorite_genre_of_rock_music": "1001",
"Auotcomplete_save_test.Favorite_genre_of_rock_music:name": null,
"Auotcomplete_save_test.Favorite_genre_of_rock_music:label": null
}
]
Getting the OptionValues for the custom field:
[
{
"id": 1001,
"value": "1",
"label": "Heavy metal",
"name": "Heavy_metal"
},
{
"id": 1002,
"value": "2",
"label": "Hard rock",
"name": "Hard_rock"
},
{
"id": 1003,
"value": "3",
"label": "Punk rock",
"name": "Punk_rock"
},
]
Expected behaviour
The option selected for the Autocomplete-Select custom field should be displayed both in View and Edit modes.
Environment information
- __CiviCRM: 5.67.1, 5.68.beta1