cancel
Showing results for 
Search instead for 
Did you mean: 

Populating selectmany.ftl from a data list or database

csamgreene
Champ in-the-making
Champ in-the-making
I would like to populate a selectmany control with data from either an Alfresco data list or from a database.  Here is an XML stanza that currently uses a hard coded list. .

               <field id="lxSmiley Tonguerimary_company" label-id="prop.lx_primary_company">
                  <control template="/org/alfresco/components/form/controls/selectmany.ftl">
                     <control-param name="options">Company1,Company2,Company3</control-param>
                  </control>
               </field>

Can someone point me to documentation on how to do so. Or better yet some example code.

Thanks
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
The control used for a given field is freemarker, and you can provide your own freemarker to render a control.

You can also provide your own client-side JavaScript that knows how to find and populate that control.

So one approach for doing what you are trying to do is to specify a custom control that includes a client-side JavaScript component that issues an AJAX call against a web service somewhere (could be an Alfresco web script running on either the Share tier or the Repository tier) that retrieves the values and populates the dropdown.

I don't know of an example of this off the top of my head and I'm sorry I don't have time to provide more details at the moment, but know that it is possible and hopefully this extremely high-level description will give you something to go on.

Jeff

erikwinlof
Confirmed Champ
Confirmed Champ
Hi,

You can find some of the sample code you need for this in the following reply:
https://forums.alfresco.com/en/viewtopic.php?f=48&t=43659#p130790

Cheers, Erik