How to change the color of background of a label within a form??

ranadip1
Kilo Explorer

How to change the color of background of a label within a form?? by default it is ash color. Any ideas?

1 ACCEPTED SOLUTION

Ashish Kumar Ag
Kilo Guru

var e = gel("label.table name.Field Name");


    e.style.backgroundColor = 'Color Name';



It will work.


View solution in original post

11 REPLIES 11

solutioningnow
Giga Guru

Hi,



For changing form label color, you need to write onLoad client script. Please refer below script for your reference:



function onLoad() {


  //Change the description label to 'My New Label' with bold red text


  changeFieldLabel('description', 'My New Label', 'red', 'bold','yellow');


}




function changeFieldLabel(field, label, color, weight,bgColor){


  try{


  var labelElement = $('label.' +   g_form.getControl(field).id);


  labelElement.select('label').each(function(elmt) {


  elmt.innerHTML = label + ':';


  });


  if(color)


  {


//Label Color


  labelElement.style.color = color;


//Label Background color


  labelElement.style.background = bgColor;


  }


  if(weight)


  labelElement.style.fontWeight = weight;


  }catch(e){}


}



Please mark answer as correct, if it was really helpful 🙂



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/


thanks it worked


Hi Ranadip,



I'm glad to hear that script worked well.



Please mark answer as correct, if it was really helpful



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/