3

I'm trying to achieve this since very long, finally I'm putting a question here.

I have created a custom content model in alfresco, which I'm able to use successfully through share. This content model is being used in a html form submission. User can enter details and save it successfully.

Now, I have another requirement. Few fields in this form are drop downs, referring to which we have List Constraint in the content model XML file. Somehow, I want to fetch the list of allowed values and use that in the FTL file to populate drop down options. I tried a lot to find a solution but my limited knowledge in alfresco is not able to find one.

Any sort of help is much appreciated...

  • 1
    Are we talking about regular share forms defined in share-config-custom.xml or similar? – billerby Feb 13 '13 at 07:19
  • No, this form is custom made which doesn't exist already. So, all the regular configurations could be missing in my case. Does it have to be configured somewhere? May be then we can pull the properties and constraints from the content model in the form...? – Vishal Kaushik Feb 13 '13 at 10:46

2 Answers2

1

Write a java based repository webscript that queries the alfresco DictionaryService to get the list of constraints and expose this as json or xml for your form to consume.

billerby
  • 1,977
  • 12
  • 22
0

as said by @billerby, you have to use a java based repository webscript to fetch the values.

You can use this code

serviceRegistry.getDictionaryService().getConstraint(constraintQName).getConstraint().getParameters().get(ListOfValuesConstraint.ALLOWED_VALUES_PARAM);

you will get a List<String> of all allowed values.

alaeddine.nasri
  • 182
  • 1
  • 2
  • 11