- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2017 03:14 AM
Hi All,
I have just added a choice list to our incident form with the choice options of Red, Amber & green. I want the background colour of the field to match these descriptions. I've added in 3 styles on this field:
On the list view this is presenting a coloured dot which is what I want:
However on the actual form the background colour does not change:
Is there a way to make the background colour also change on the form?
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2017 03:32 AM
Hi Sam,
You can use below script
only thing is to have the field name changed as desired & additional else condition added if required. Also, in place of riskimpact == '1' you can have your choice name added as riskimpact == 'amber' etc.
Thanks,
Jaspal Singh
Hit Like or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2017 03:20 AM
Hi Sam,
Create onChange client on your field,
for me i have created on Incident table : State field,
Please Replace your table name & Field name in the below code
function onChange(control, oldValue, newValue, isLoading) {
var elementID = gel("incident.state");
switch (newValue) {
case "1":
elementID.style.backgroundColor = "Gray";
break;
case "2":
elementID.style.backgroundColor = "tomato";
break;
case "3":
elementID.style.backgroundColor = "orange";
break;
case "4":
elementID.style.backgroundColor = "yellow";
break;
case "5":
elementID.style.backgroundColor = "green";
break;
default:
elementID.style.backgroundColor = "Lightgreen";
break;
}
}
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2017 03:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2017 04:00 AM
Hi Sam,
Remove your 2nd line,3rd line,4th line of code and try again.
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2017 04:06 AM
I've tried this but still only changing the colour on the list view and not changing it on the form.