ndegoeij
I'm new here

FS_LIST get title from combobox selection in FS_LIST label

Jump to solution

I have created a FS_LIST as below

  <FS_LIST name="st_orglist" hFill="yes">

    <DATASOURCE type="inline" useLanguages="no">

      <LABELS>

        <LABEL lang="*">

            if(!#item.st_organisation.isEmpty, #item.st_organisation, "")

        </LABEL>

      </LABELS>

      <ACTIONS>

        <ACTION name="ADD"/>

        <ACTION name="REMOVE"/>

        <ACTION name="UP"/>

        <ACTION name="DOWN"/>

        <ACTION name="EDIT"/>

      </ACTIONS>

      <COLUMNS>

        <COLUMN show="no">#identifier</COLUMN>

        <COLUMN show="yes">#text</COLUMN>

      </COLUMNS>

      <LAYOUT>

        <ADD component="toolbar" constraint="top"/>

        <ADD component="overview" constraint="center"/>

        <ADD component="stackedview" constraint="bottom"/>

      </LAYOUT>

      <TEMPLATES source="sectiontemplates">

        <TEMPLATE uid="st_organisationlist"/>

      </TEMPLATES>

    </DATASOURCE>

    <LANGINFOS>

      <LANGINFO lang="*" label="Edit sections"/>

    </LANGINFOS>

  </FS_LIST>

Which relies on the following section template st_organisationlist:

  <CMS_INPUT_COMBOBOX name="st_organisation" allowEmpty="no" singleLine="no" sortOrder="ascending" useLanguages="no">

    <CMS_INCLUDE_CONTENT type="entries" table="CIS.organisation">

      <LABEL lang="*">#row.organisation</LABEL>

    </CMS_INCLUDE_CONTENT>

    <LANGINFOS>

      <LANGINFO lang="*" label="Organisation"/>

    </LANGINFOS>

  </CMS_INPUT_COMBOBOX>

The label mentioned in the FS_LIST:

<LABEL lang="*">

    if(!#item.st_organisation.isEmpty, #item.st_organisation, "")

</LABEL>

should now display the selected organisation name when selecting one from the dropdown list. This however does not seem to work, althoug it does work for an text input item.

Could someone tell me what I am missing or overlooking?

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions

I'm sorry, of course I meant

<LABEL lang="*">if(!#item.st_organisation.isEmpty, #item.st_organisation.value.name, "")</LABEL>

#item.st_organisation will return an Option object, representing the entry you selected. Therefore you need to add .value that will return the actual value of the selected entry. In your case it is an Entity object. At last you have to add the name of the column that you wnat to be displayed.

Best regards

Tim

View solution in original post

0 Kudos
4 Replies
pavone
I'm new here

Hello,

are you using FirstSpirit 5? Please note that in FirstSpirit 5 CMS_INPUT_CONTENT has been replaced by CMS_INCLUDE_OPTIONS. Here you can find more information regarding this component.

For your label try

<LABEL lang="*">if(!#item.st_organisation.isEmpty, #item.st_organisation, "")</LABEL>

Best regards

Tim

0 Kudos

Dear Tim,

Thank you for your answer. However as I already mentioned I have tried the LABEL if statement and it does not seem to work.

And as I forgot to mention we are using FirstSpirit 4.2.499.

Best Regards,

Nando

0 Kudos

I'm sorry, of course I meant

<LABEL lang="*">if(!#item.st_organisation.isEmpty, #item.st_organisation.value.name, "")</LABEL>

#item.st_organisation will return an Option object, representing the entry you selected. Therefore you need to add .value that will return the actual value of the selected entry. In your case it is an Entity object. At last you have to add the name of the column that you wnat to be displayed.

Best regards

Tim

0 Kudos

Hi Tim,

Thanks again for your reply. I had to look into your answer but it works like a charm.

Best regards,

Nando

0 Kudos