AnsweredAssumed Answered

Form in share simpleDialog

Question asked by ingon on Jun 17, 2014
Latest reply on Jun 26, 2014 by ingon
I'm trying to show a full functional form in a simpleDialog called from a documentlibrary action, but I can'f make it work, since it never reaches the onSuccess event.

Here is where the action is defined:

   <config evaluator="string-compare" condition="DocLibCustom">
         <js src="/components/import/import-actions.js" />

   <config evaluator="string-compare" condition="DocLibActions">
         <action id="alfresco_import_permissions" type="javascript" label="action.import.permissions"
            <param name="function">onActionOpenForm</param>
         <actionGroup id="folder-browse">
            <action index="230" id="alfresco_import_permissions" />

Here, the onActionOpenForm implementation in the file import-actions.js:

(function() {"registerAction", {
      actionName : "onActionOpenForm",
      fn : function onActionOpenForm(record) {
         var actionUrl = YAHOO.lang.substitute(Alfresco.constants.PROXY_URI + "alfresco/importer/{uri}",
                  uri : this.doclistMetadata.parent.nodeRef.replace(":/", "")
         var templateUrl = Alfresco.constants.URL_SERVICECONTEXT + "alfresco/import/uploadcontent";
         var uploadZip = new Alfresco.module.SimpleDialog( + "-uploadContent");
            width : "50em",
            templateUrl : templateUrl,
            actionUrl : actionUrl,
            onSuccess : {
               fn : function DLTB_onUploadContent_success(response) {
               scope : this
            onFailure : {
               fn : function DLTB_onUploadContent_failure(response) {
               scope : this


Here, the form that is rendered in the popup:

<#assign el=args.htmlid?html>
<div id="${el}-dialog" class="upload-content">
   <div id="${el}-dialogTitle" class="hd">${msg("page.importZipFile.title")}</div>
   <div class="bd">
      <form id="${el}-form" action="" method="post" enctype="multipart/form-data" accept-charset="utf-8">
         <div class="yui-gd">
            <div class="yui-u first"><label for="${el}-filedata">${msg("label.filedata")}:</label></div>
            <div class="yui-u"><input type="file" id="${el}-filedata" name="filedata" tabindex="0" style="width:100%"/></div>
         <div class="bdft">
            <input type="submit" id="${el}-ok" value="${msg("button.ok")}" tabindex="0" />
            <input type="button" id="${el}-cancel" value="${msg("button.cancel")}" tabindex="0" />

Alfresco websccript that is called in the form action:


   <shortname>Import permissions</shortname>
   <description>Import permissions</description>
   <format default="json">argument</format>

Java class:

package alfresco.beans.web.scripts;


import org.alfresco.service.cmr.repository.NodeService;
import org.json.simple.JSONObject;
import org.springframework.extensions.webscripts.AbstractWebScript;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;

public class ImportPermissions extends AbstractWebScript {

   NodeService nodeService;

   public final NodeService getNodeService() {
      return nodeService;

   public final void setNodeService(NodeService nodeService) {
      this.nodeService = nodeService;

   public ImportPermissions() {

   public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException {

      JSONObject jsonObject = new JSONObject();
      jsonObject.put("value1", "data1");
      jsonObject.put("value2", "data2");

      String jsonString = jsonObject.toString();



When I click ok in the form, I can debug the alfresco webscript and the execute() method is correct, without errors. The problem I have is that the onSuccess event in onActionOpenForm is never reached, even debugging the simple-dialog.js.

Am I doing anytthing wrong? Do I have to add or remove something in my code??

Thanks in advance!!