- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FS_LIST get title from combobox selection in FS_LIST label
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.
- Labels:
-
Developers
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
Thanks again for your reply. I had to look into your answer but it works like a charm.
Best regards,
Nando

