AnsweredAssumed Answered

Need to post data to repo webscript and after success redirect to another page using aikau .

Question asked by vikash.patel@contcentric.com on Oct 24, 2017

This is my code 

// Create the form control for the student
var createDocFormWidget = [ {
     name : "alfresco/forms/controls/DojoValidationTextBox",
     config : {
          align : "left",
          hideValidation : "false",
          fieldId : "name",
          label : "Name :",
          description : "Name of document type",
          placeHolder : "Name",
          name : "name",
          validationConfig : [ {
               validation : "minLength",
               length : 1,
               errorMessage : "Please enter minimum one."
          } ]
     }
},

{
     name : "alfresco/forms/controls/DojoValidationTextBox",
     config : {
          align : "left",
          fieldId : "abbreviation",
          label : "Abbreviation :",
          description : "Abbreviation type",
          placeHolder : "Abbreviation",
          name : "abbreviation",
          additionalCssClasses : "no-margin",
          validationConfig : [ {
               validation : "minLength",
               length : 1,
               errorMessage : "Please enter minimum one."
          } ]
     }
} ];



var typeForm = {
     name : "alfresco/forms/Form",
     config : {
          class : "form-container label",
          // warningsPosition: "right",
          showValidationErrorsImmediately : false,
          align : "center",
         
          showOkButton : true,
          okButtonLabel : "Save",
          showCancelButton : false,
          cancelButtonLabel : "Cancel",
          setValueTopic : "Submit",
          setValueTopicGlobalScope : true,

          // Specify the TOPIC here ALF_CRUD_CREATE
          okButtonPublishTopic : "ALF_CRUD_CREATE",
          okButtonPublishGlobal : true,
          okButtonPublishPayload : {
               // Specify the URL here to POST the data
               url : "/test/post-data",
               successMessage : "Document type being created successfully ...",
               failureMessage : "Abbreviation/Document type already exist.",
          },
          widgets : createDocFormWidget
         
     }
};

model.jsonModel = {
     widgets : [typeForm],
     services : [ "alfresco/services/CrudService",
               "alfresco/services/OptionsService",
               "alfresco/services/UserService", "alfresco/pickers/Picker",
               "alfresco/core/Core", "alfresco/services/BaseService"

     ]
};

Using this code I am  able to post data to webscript.


I tried with JSDoc: Module: alfresco/services/NavigationService but I am not able to navigate after success of form submission.
How to post data to repo webscript and after success redirect to another page . ?

Outcomes