- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2022 02:17 AM
Hi everyone!
I created an onChange client script to change the color of a reference field on my form when it changes, but somehow my code doesn't work. The trigger condition is the same field that's color should be changed.
if (conditionValue == "1") {
var element = g_form.getElement('reference_field');
element.style.backgroundColor = "red";
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2022 02:47 AM
Hi,
User getDisplayBox() instead of getElement().
e.g.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var c = g_form.getDisplayBox('user');
c.style.backgroundColor = 'red';
}
execution result:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2022 02:23 AM
Can you share entire script? what field is "conditionValue "?
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2022 02:49 AM
conditionValue is a returned integer from a function.(There was an additional condition for this but my code is quite long, that's why I only added this part). I debugged everything so the code works fine, except he coloring part.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2022 02:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 10:25 PM
how to do it for onload function