Multi-Select Checkbox Pick-list within Microsoft Dynamics 4.0.

This question has suggested answer(s)

Hey everyone, I am trying to create a Multi-Select Checkbox Pick-list within Microsoft Dynamics 4.0. I was able to create the checkbox using Jim Wangs Code from http://jianwang.blogspot.com/search/label/Picklist

I followed the directions, I am just not sure if i need to put the values that are in my picklist within this script and if so, I have no idea where. I am kind of a newbie to Java Script so I was not sure what fields needed to be changed (or what colors mean what). Also When i insert the script and put in my PL and PLV names; I am able to see the checkbox on my Account forum screen and the values, but when i hit save and close, It will not save.  I put a picture at the bottom of an example of what it looks like. In my picklist the values i have are ( Value, Value1, Value2) did this because it was a test for me to figure out where everything went and if the values needed to be in the script. As you can see in the code I have not put in the picklist values, this may be causing the save error; I just have NO idea what to change and where to insert it. I have had no luck with anyone helping me with this. So any and all help would greatly be appreciated. Please help,

 

Diamond

 

 

 

 

 

var PL = crmForm.all.new_picklist; 

var PLV = crmForm.all.new_picklistvalue; 

 PL.style.display = "none"; 

 PLV.style.display = "none"; 

 var addDiv = document.createElement("<div style='overflow-y:auto; height:80px; border:1px #6699cc solid; background-color:#ffffff;' />"); 

 PL.parentNode.appendChild(addDiv); 

 for( var i = 1; i < PL.options.length; i++ ) 

 { 

   var pOption = PL.options[i]; 

   if( !IsChecked( pOption.text ) ) 

      var addInput = document.createElement("<input type='checkbox' style='border:none; width:25px; align:left;' />" ); 

    var addLabel = document.createElement( "<label />"); 

    addLabel.innerText = pOption.text; 

   var addBr = document.createElement( "br");
 
  PL.nextSibling.appendChild(addInput); 
  PL.nextSibling.appendChild(addLabel); 
  PL.nextSibling.appendChild(addBr); 
 } 

  function IsChecked( pText ) 

  { 
    if(PLV.value != "") 
  { 
      var PLVT = PLV.value.split("||"); 
      for( var i = 1; i < PLVT.length; i++ ) 
      { 
         if( PLVT[i] == pText ) 
            return true; 

         } 
    } 
        return false; 
 } 

 crmForm.attachEvent( "onsave" ); 
 function OnSave() 
 { 
   PLV.value = "br"; 
   var getInput = PL.nextSibling.getElementsByTagName("input"); 

   for( var i = 1; i < getInput.length; i++ ) 
   { 
      if( getInput[i].checked) 
     { 
       PLV.value += getInput[i].nextSibling.innerText + "||"; 

     } 

   } 

 

 

 

All Replies
  • Hello

    Try to change line

    crmForm.attachEvent( "onsave" );  

    to

    crmForm.attachEvent( "onsave", OnSave);  

    Microsoft CRM Freelancer