- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 11:06 PM
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?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2018 12:09 AM
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';
}
}
Let me know if you need any further help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 12:44 AM
Hi Sonbol,
Try with this onchange client script on color field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
var a = g_form.getValue('u_choice_1'); // color field value
var b = document.getElementById('sys_display.incident.caller_id'); // id of the requester field
if(newValue == 'yellow'){
b.style.backgroundColor = 'yellow';
}
if(newValue == 'green'){
b.style.backgroundColor = 'green';
}
if(newValue == 'red'){
b.style.backgroundColor = 'red';
}
//Type appropriate comment here, and begin script below
}
Thanks,
Kh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 09:16 AM
This is my code based on your suggestion , but still not working:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var a = g_form.getValue('color');
var b = document.getElementById('req');
if(newValue=='Green')
{
b.style.backgroundColor = 'green';
//alert("green");
}
else if (newValue=='Red')
{
b.style.backgroundColor = 'red';
// alert("red");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 09:19 AM
and we are not using variable a anywhere in the code right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 11:07 PM
Hi Sonbol,
Is it for catalog item variable?
Thanks,
Kh