Naman
Naman

Reputation: 2203

Dynamically set value in category.ftl

I have a form in share with multiple fields using category.ftl. I want to set default values in those fields dynamically. I can set default value by passing static path of category in share-config-custom.xml. But now my requirement is to read values stored in one file and than set those values as default in category.ftl.

Final Output

For ex, On above screenshot I have set default language as English by passing English reference statically in share-config. So every time when a form renders it sets English as default language. I want this to be changed to set default language to value which is stored in file. So how to pass dynamic reference of category in share-config-custom.xml file?

Any help would be greatly appreciated!!!

Upvotes: 0

Views: 880

Answers (1)

Krutik Jayswal
Krutik Jayswal

Reputation: 3175

You cant configure dynamic things in share-config-custom.xml.For that you need to workj on below things.

For each and every picker in alfresco ,alfresco share is using below javascript file.(This are YUI scripts)

1.generic-object-finder.js
2.object-finder.js

object-finder.js = > This file is generally used when type of content is authority(users of alfresco).So i think this will be not used in your case.

generic-object-finder.js = > This file is used for generic picker and using this you can set default values.

====================================================================== Below are steps to set value in picker.

1.Alfresco.util.ComponentManager.list("Alfresco.GenericObjectFinder")
Above method will return all object of picker , We need to pick one by one and set default value one by one in alfresco advanced search.It will return object in array form

2. X.options.defaultValue need to be set. Where X will first element of Alfresco.util.ComponentManager.list("Alfresco.GenericObjectFinder") array

3.x.selectItems("workspace://SpacesStore/f73a4de7-7a45-412d-ac7d-56061fcf9d76")
Above will set default value.You must need to pass relevant value here.

Upvotes: 1

Related Questions