How to change the background color of requestor field?

sonbol_montakha
Giga Contributor

When selecting the color from the 'select color ' field, for example if green is selected , the background color of requester field needs to be changed to green. Any thoughts please?

find_real_file.png

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

Hi Sonbol,



here you go..


i have written onLoad() catalog client script



i have tested and it's working. just change the variable name as per you have deigned.



function onLoad() {


//Type appropriate comment here, and begin script below


var check= g_form.getValue('color');   //"color" is my variable name change as per your variable name


if(check=='green')


{


$('sys_display.'+ g_form.getControl('user').id).style.backgroundColor = 'red';


}


}





find_real_file.png



find_real_file.png



Let me know if you need any further help.


View solution in original post

8 REPLIES 8

Aman3
Tera Contributor

Hi,



Please try this: This is catalog client script. You can modify for task based fields.



function onLoad() {


    //Set styles for the 'caller_id' variable


    var myVar = $('sys_display.' + g_form.getControl('logged_in_user').id);


    myVar.style.width = '350px';


    myVar.style.backgroundColor = 'LimeGreen';


    myVar.style.color = 'blue';


    myVar.style.fontStyle = 'italic';




    //Set styles for the 'impact' variable


    var myVar2 = g_form.getControl('department');


    myVar2.style.width = '200px';


    myVar2.style.backgroundColor = 'yellow';


    myVar2.style.color = 'purple';


    myVar2.style.fontWeight = 'bold';



    }





Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.





Thanks,


Aman


Aman3
Tera Contributor

Special mention to   the following line in my catalog client script, used for reference field.



var myVar = $('sys_display.' + g_form.getControl('logged_in_user').id);





Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.



Thanks,


Aman


Harsh Vardhan
Giga Patron

Hi Sonbol,



here you go..


i have written onLoad() catalog client script



i have tested and it's working. just change the variable name as per you have deigned.



function onLoad() {


//Type appropriate comment here, and begin script below


var check= g_form.getValue('color');   //"color" is my variable name change as per your variable name


if(check=='green')


{


$('sys_display.'+ g_form.getControl('user').id).style.backgroundColor = 'red';


}


}





find_real_file.png



find_real_file.png



Let me know if you need any further help.


find_real_file.png


find_real_file.png