- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2018 10:46 AM
Hello everyone,
I would like to change the number of the text color to red when it is a P1 incident, I have this script but seems not to be working:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (priority == '1') {
NumberField.setStyle({color: "red"});
}
//Type appropriate comment here, and begin script below
}
..........................................
Anyone can help me out?
Thank you!
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2018 11:42 AM
Thank you everyone, here is the answer:
----------------------------------------------------------------
function onLoad() {
//Type appropriate comment here, and begin script below
if ( g_form.getValue("priority") == 1 ) {
g_form.getElement("number").setStyle({color: "red"});
}
}
----------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2018 10:59 AM
Hi,
You need to write onLoad client script to set the color of the field when form opens
if ( g_form.getValue("priority") == 1 ) {
g_form.getElement("number").style.background = "red";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2018 11:09 AM
Hello Deepak,
what if instead of the background I would like to change the text color only.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2018 11:01 AM
Please modify your code like below
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (g_form.getValue('priority') == '1') {
NumberField.setStyle({color: "red"});
}
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2018 11:11 AM
Hello Sachin,
I tried like that and did not work. =(