AnsweredAssumed Answered

can we add Check-list  of item and save it as association

Question asked by fos13 on May 6, 2015
Hi Team

I have two datalist and i want to show in form a Check-list of auther datalist i can get all list but i can not save it in association.
I use Alfresco 4.2 in linux centos 5.

this is my file :

<#assign controlId = fieldHtmlId + "-cntrl">
<script type="text/javascript">//<![CDATA[
getQueryVariable : function getQueryVariable(variable) {
var query = window.location.search.substring(1)
var vars = query.split("?");
for (var i=0;i<vars.length;i++) {
    var pair = vars.split("=")
    if(pair[0] == variable){
        if(pair[1].indexOf('%20') != -1){
            console.log(pair[1].indexOf('%20'))
            var fullName = pair[1].split('%20')
            console.log(fullName)
            return fullName[0] + ' ' + fullName[1]
        }
        else {
            return pair[1];
        }
    }
}
return(false)
}


   getTaskName: function getTaskName(res){
     
        var myField = document.getElementById('${fieldHtmlId}');
      
       
      var result = eval('(' + res.serverResponse.responseText + ')');   
      var Tasks = result.legends;
      var i;
      for(i=0;i<Tasks.length;i++) {
         // If the current field's value is equal to this value, don't add it.
         if(Tasks === null ) {
            continue;
         }
         myField.add(new Option(Tasks.label, Tasks.id));
      }
    };
   // var site = Alfresco.constants.SITE;
    // var node = getQueryVariable("nodeRef");
      
   Alfresco.util.Ajax.request({
   method: Alfresco.util.Ajax.GET,
   url : Alfresco.constants.PROXY_URI + "/getAutoCompletion/getAutoCompletion",
   requestContentType: "application/json",
   responseContentType: "application/json",
   successCallback : {
      fn : getTaskName,
      scope : this,
   },
   failureCallback : {
      fn : function() {},
      scope : this
   },

   execScripts: true
   });
   
//]]></script>

<div id="${controlId}" class="object-finder">
<label for="${fieldHtmlId}">${msg("Legend")}:<#if field.mandatory><span class="mandatory-indicator">${msg("form.required.fields.marker")}</span></#if></label>

<select id="${fieldHtmlId}" name="${field.id}" tabindex="0"
       <#if field.control.params.styleClass??>class="${field.control.params.styleClass}"</#if>
       <#if field.control.params.style??>style="${field.control.params.style}"</#if>>
      
</select>

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


Best regard.

Outcomes