cancel
Showing results for 
Search instead for 
Did you mean: 

add data to option of selectmany.ftl

zlu
Champ in-the-making
Champ in-the-making
Hi,

I have a field in the form referencing the selectmany.ftl template, and it allows me to add the option to the list by hardcoding.

I want to know how to add data to the field by code?

And also, how can I use jquery for the field?

Thanks,
Daniel
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
One thing you could do is create your own version of the selectmany.ftl template. Copy $TOMCAT_HOME/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/form/controls/selectmany.ftl into $TOMCAT_HOME/webapps/share/WEB-INF/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/form/controls/selectmanywithcode.ftl and then modify as you see fit. You'll have to use share-config-custom.xml to tell Alfresco to use your custom control for the specific fields that make sense.

What you may find is that the options you want to add using code need to get some data from the repository that hasn't been handed to the control in a variable. When that happens you can drop a little client-side JavaScript into your template and make AJAX calls to the repository tier web scripts via the Share proxy. There are out-of-the-box Alfresco utilities on the client-side that wrap YUI to make this easy once you know how they work.

Sorry I don't have time to provide further detail, but maybe that gives you some ideas.

Jeff