- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 11:28 PM
Hi Everyone,
I am trying the below client script but it is not working. The field type is currency-
function onLoad() {
//Type appropriate comment here, and begin script below
if(g_form.getValue('u_hard_savings')<0){
var element = g_form.getElement('u_hard_savings');
element.style.backgroundColor='red';
}
}
Any hints would be helpful, thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 12:32 AM
Tried with Field Style but condition in Value field only works on a list and not on the form. It's either always red or none.
Is this for ServicePortal or for UI?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 11:30 PM
Hi Tapish,
Try using g_form.getControl('u_hard_savings')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 11:36 PM
Hi Hitoshi ,
i am trying to add the bg color , but that is not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 11:39 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 11:41 PM
The problem maybe with the if statement. Following is comparing value of u_hard_savings field to be less than 0. For this to be true, field u_hard_saving must return an integer. What is the type of u_hard_saving?
g_form.getValue('u_hard_savings')<0