cancel
Showing results for 
Search instead for 
Did you mean: 

Get property values in FTL Control Methods

guilherme_souza
Champ in-the-making
Champ in-the-making
Hi, I've found a folder in Alfresco that contains some methos in the format .ftl, I'm trying to create a new FTL method and I need to get the value of a property. I tried to reference the property using this:
 = properties["cm:property"]
But it doesn't work. Anyone know how to do that?
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
ftl files are freemarker, not java script.

Which script are you trying to change and where is your "property"?    A freemarker template is used to display a "model" which is populated by a "controller".

Assuming you have something in the model called "rhubarb", it would be displayed by an expression like ${rhubarb}

guilherme_souza
Champ in-the-making
Champ in-the-making
I'm using the ftl to call a javascript function.




   <#assign numProc = properties["cm:nprocesso"]>

   <input type="button" name="btn1" value="Botao" onClick="valida()">
   <script>
      function valida(){
         var nprocesso = properties["cm:nprocesso"];
         //var nnprocesso;
         //var mensagem;
         //if (nprocesso.search(/\s/g) != -1){
         //   nnprocesso = nprocesso.replace(/\s/g ,"");
         //}
         //if (nprocesso.search(/[^0-9]/i) != -1){
         //   nnprocesso = nprocesso.replace(/[^0-9]/gi,"");
         //}
         //"${field.value}" = nnprocesso;
         alert(nprocesso.value);
         //return "123";
      }
   </script>

At the first line of the code, I have to get the value of the property cm:nprocesso

gaurav_shirbhat
Champ in-the-making
Champ in-the-making
Please tell me about report generation in alfresco.
1. Report is created for contents information, am i right?
2. Report is automatically generated in alfresco or we have to create report?
3. I have to export that reports to pdf.
Please give me solution for above questions.