Started: 12/5/2021 1:44 AM
Picture Placeholder: Jim Hidson.
Jim Hidson.
How to change the color of CheckBoxList items?

In order to change the color of CheckBoxList items you can use this code in an action Form’s rule, even=onLoad
 
try{
var checkBoxList = $('[id$="Checkboxlist1"]');
        var options = checkBoxList[0].getElementsByTagName('input');
 
        for (var i = 0; i < options.length; i++) {
           
               if (i==0) { options[i].parentElement.style.color = 'red';}
          if (i==1) { options[i].parentElement.style.color = 'green';}
          if (i==2) { options[i].parentElement.style.color = 'blue';}
         
            
        }
 
} catch (error) {
}
 
However, you cannot map this type of controls to form variables especially if it is multiple values, this control must be mapped to a multiple values choice type column in a list. It just inapplicable to use it the way we did with dropdown list.
 

 ​
Picture Placeholder: Jim Hidson.
  • Jim Hidson.
/_layouts/15/images/person.gif" alt="Picture Placeholder: Jim Hidson." />
Jim Hidson.

In order to change the color of CheckBoxList items you can use this code in an action Form’s rule, even=onLoad
 
try{
var checkBoxList = $('[id$="Checkboxlist1"]');
        var options = checkBoxList[0].getElementsByTagName('input');
 
        for (var i = 0; i < options.length; i++) {
           
               if (i==0) { options[i].parentElement.style.color = 'red';}
          if (i==1) { options[i].parentElement.style.color = 'green';}
          if (i==2) { options[i].parentElement.style.color = 'blue';}
         
            
        }
 
} catch (error) {
}
 
However, you cannot map this type of controls to form variables especially if it is multiple values, this control must be mapped to a multiple values choice type column in a list. It just inapplicable to use it the way we did with dropdown list.
 

 ​
012/5/2021 1:44 AM12/5/2021 1:44 AMNoCodes & Scripts
0
12/2/2021 4:19 AM
There are no items to show in this view of the "Discussions List" discussion board.