cancel
Showing results for 
Search instead for 
Did you mean: 

Get the current document name and url in control template

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

Right now I have a custom control template, which I want to display the document name and the URL to it.

I tried to use "${document.name}" but no luck.

Can you give me some idea about this magic?

Cheers,
Daniel
2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
try ${document.properties.name}

zlu
Champ in-the-making
Champ in-the-making
No Luck.

The followed is the error message in tomcat log and my template:

Expression document is undefined on line 25, column 103 in org/alfresco/components/emailsubjecttemplate.ftl.
The problematic instruction:
———-
==> ${document.properties.name} [on line 25, column 101 in org/alfresco/components/emailsubjecttemplate.ftl]
in include "${field.control.template}" [on line 90, column 7 in org/alfresco/components/form/form.lib.ftl]
in user-directive renderField [on line 121, column 13 in org/alfresco/components/form/form.lib.ftl]
in user-directive formLib.renderSet [on line 23, column 16 in org/alfresco/components/form/form.get.html.ftl]
in user-directive formLib.renderFormContainer [on line 20, column 7 in org/alfresco/components/form/form.get.html.ftl]

<div class="form-field">
   <#if form.mode == "view">
      <div class="viewmode-field">
         <#if field.mandatory && !(field.value?is_number) && field.value == "">
            <span class="incomplete-warning"><img src="${url.context}/res/components/form/images/warning-16.png" title="${msg("form.field.incomplete")}" /><span>
         </#if>
         <span class="viewmode-label">${field.label?html}:</span>
         <#if field.control.params.activateLinks?? && field.control.params.activateLinks == "true">
            <#assign fieldValue=field.value?html?replace("((http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?\\^=%&:\\/~\\+#]*[\\w\\-\\@?\\^=%&\\/~\\+#])?)", "<a href=\"$1\" target=\"_blank\">$1</a>", "r")>
         <#else>
            <#if field.value?is_number>
               <#assign fieldValue=field.value?c>
            <#else>
               <#assign fieldValue=field.value?html>
            </#if>
         </#if>
         <span class="viewmode-value"><#if fieldValue == "">${msg("form.control.novalue")}<#else>${fieldValue}</#if></span>
      </div>
   <#else>
      <label for="${fieldHtmlId}">${field.label?html}:<#if field.mandatory><span class="mandatory-indicator">${msg("form.required.fields.marker")}</span></#if></label>
      <input id="${fieldHtmlId}" name="${field.name}" tabindex="0" value="${document.properties.name}"

      <@formLib.renderFieldHelp field=field />
   </#if>
</div>

Thanks.