cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an extra custom button to a Share form

pkanuri
Champ on-the-rise
Champ on-the-rise

I have been trying , in vain, to add a "Preview" button to my share form.
After making changes to the share-config-custom.xml I did these things:

1. Edit the form.lib.ftl

   Here is what I added to the renderFormButtons macro
  
   <#if form.showPreviewButton?? && form.showPreviewButton>
         <input id="${formId}-preview" type="button" value="${msg("form.button.cancel.label")}" />
   </#if>
  
  
2. Edit my xml file in the ../site-data/template-instances folder
   
   I used <showPreviewButton>true</showPreviewButton> to be able to display the button .

   Extract:
   
   <component>
         <region-id>create-ediscovery-search-request-content</region-id>
         <url>/components/form?mimeType=text/html&amp;destination=${destination}&amp;formId=ediscoverysearch</url>
         <properties>
            <itemKind>type</itemKind>
            <itemId>cs:ediscoverysearch</itemId>
            <mode>create</mode>
            <submitType>json</submitType>
            <showCaption>true</showCaption>
            <showCancelButton>true</showCancelButton>
         <showResetButton>true</showResetButton>
         <showPreviewButton>true</showPreviewButton> 
      </properties>
      </component>  
    
    
     But still the button does not appear in my form.
     Am I missing anything ? Or is it that one cannot declare buttons other than the predefined
     ones like (submit, reset, cancel)?
    
     Please advise.
  
1 REPLY 1

lementree
Champ on-the-rise
Champ on-the-rise
Hi,

To do this you need to make changes to org.alfresco.web.scripts.forms.FormUIGet by overriding it.
In this class you need to hande you new parameter and set that to form, so you can use it in ftl.
like:
formUIModel.put(MODEL_SHOW_PREVIEW_BUTTON, discoverBooleanParam(context, MODEL_SHOW_PREVIEW_BUTTON));

Regards,