Dropdown: EditView.tpl shows value, DetailView shows key - WHY?

Hello together

Based on this good howto I changed the county textfield in Contacts and Accounts to a dropdown list:

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.7/User_Interface/Fields/Changing_Address_Country_Field_to_a_Dropdown/

It’s working like a charm with multiple languages in both EditViews and ListViews, but in the DetailViews there is an interesting behavior: instead of showing the value/label of the selected and saved country, it shows the key of the dropdown list instead! When working in english, it’s the same text. But in other languages I select e.g. “Schweiz” during edit, and it shows “SWITZERLAND” in DetailsView.

The corresponding line from the de_CH.DetailView.tpl is this:

{$fields.{{$displayParams.key}}_address_country.value|escape:‘html_entity_decode’|escape:‘html’|url2html|nl2br}

Has anyone an explanation for this? And maybe a helping hand? :wink:

I’m using SuiteCRM Version 7.6.6 (Sugar Version 6.5.23 Build 1061).

Thanks a lot!
Cheers, Kai

As an addition to my question:

If I use the studio to put this country field into the searchpopup to select an account, the country is shown translated correctly in the list of accounts. But I’m unable to find the HTML or PHP file to check how it is implemented there and where the difference is to the DetailView.tpl. I found the PopupPicker.html, but that’s not the right place…

It might be a bug within the use of the suitecrm enum-functions, so that in DetailView the key is shown instead of the correct language based value.

Has somebody a clue for me, where to look?
Thanks :slight_smile:

Hi
Im have similar bug in my Suite. But i seen in editview right value and on Detail, list and Dashlet wrong - i seen key of dropdown.
In my case Modulebuilder lost type of variable, and write ‘varchar’ in place of ‘dymaicenum’.
In file /modules/YourModule/metadata/WhatYouNeed.view.php.
i think, you may look in that file, may be you fix it.
Goodluck.

Try using:

=================================================

{assign var=“country_key” value=$fields.{{$displayParams.key}}_address_country.value}
{if isset($fields.{{$displayParams.key}}_address_country.options.$country_key)}
{$fields.{{$displayParams.key}}_address_country.options.$country_key|escape:‘html_entity_decode’|escape:‘html’|url2html|nl2br}
{else}
{$country_key|escape:‘html_entity_decode’|escape:‘html’|url2html|nl2br}
{/if}

=================================================
It worked for me.