cancel
Showing results for 
Search instead for 
Did you mean: 

how to send parameter in action url of showdialog

skumar_us
Champ in-the-making
Champ in-the-making
I am doing a customization in share where on click of a link say "send email" i am displaying a dialog-box as attached emailform.jpg.how can I pass the value of parameter subject and textfield in the actionUrl of showdialog.

The code is for display dialog is as below:


populateCandidateEmailForm: function populateCandidateEmailForm(responseJSON,asset,emailID)
     {
       var displayValue = "";
      var subjectField = "";
      var textField = "";
      
      var emailDialog = new Alfresco.module.SimpleDialog(this.id + "-candidate_email_dialog").setOptions({
            width: "40em",
            templateUrl: YAHOO.lang.substitute(Alfresco.constants.URL_SERVICECONTEXT + "components/form?itemKind={itemKind}&itemId={itemId}&showCancelButton=true&submitType=json&formId={formId}",
            {
               itemKind: "type",
               itemId: "impublic:sendCandidateEmail",
               formId: "sendCandidateEmail",
              
            }),
           actionUrl: Alfresco.constants.PROXY_URI + "com/sendcandidateemail?recepients="+emailID+"",
           doBeforeDialogShow:
              {
                 fn: function(formsRuntime, emailDialogObject){
                    this.form.submitElements[0].set('label','Send');
                    var dialogHeader = Dom.get(formsRuntime.formId + '-container_h');
                    dialogHeader.innerHTML = "Candidate Email Form";
               
                       var fields = document.getElementsByName('prop_impublic_candidateadditionalInfo');
                    var nodeRefs = [];
                    for(x in asset){
                      nodeRefs.push(asset[x].nodeRef);
                    }
                    var siteName = Alfresco.constants.SITE;
                    var additionalInfo = "{\"documents\":\"" + nodeRefs + "\"," +
                                          "\"site\":\"" + siteName + "\"," +
                                          "\"sender\":\"" + responseJSON.sender + "\"," +
                                          "\"template\":\"" + responseJSON.template + "\"}";
                    fields[0].value = additionalInfo;
                 },
                 obj: null,
                 scope: null
              },
              doSetupFormsValidation:
              {      

                 fn: function(form){
                    form.addValidation("template_x002e_toolbar_x002e_tabsearch-email_dialog_prop_impublic_to", null, "Email is not valid!");
                 },
                 obj: null,
                 scope: null
              },
          
           onFailure:
              {
                 fn: function(response){
                    if(response.json.status == 400){
                       Alfresco.util.PopupManager.displayPrompt(
                             {
                                    text: response.json.message
                              });
                    }
                 },
                 obj: null,
                 scope: window
              }
           
         });
         emailDialog.show();
     },

2 REPLIES 2

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

You can set the email and subject in doBeforeDialogShow method,by getting the elements with the id as you did for fields.

Regards

gits009
Champ in-the-making
Champ in-the-making
I have the similar problem but I am unable to send the json data with action url. please see my code below:

             
              var actionUrl =   YAHOO.lang.substitute(Alfresco.constants.PROXY_URI + $combine("slingshot/doclib/action/aspects/node/", jsNode.nodeRef.uri),
{      
      requestContentType: Alfresco.util.Ajax.JSON,
        method: Alfresco.util.Ajax.POST,
        dataObj:
        {
      htmlid: this.id + "-changeType",
      dataObj:{
      

                  curTyp: this.currentType
             }
        }});


The json data I passed in dataObj, I am unable to get when actionUrl is executed.