Set font color in a script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2013 02:01 PM
I am displaying the Caller's phone number on the incident form and setting it to read-only through a script. The script displays the phone number field only if it contains a value, and uses setReadOnly() to set it to read-only. The problem I am having is that the read-only field is grayed out making it hard to read, and I would like to set the font color to black.
My first solution was to create a new Field Style and set the 'phone' field color to black. This works exactly how I want it to on Firefox, but when I open the form on Internet Explorer the field is still grayed out. When the form first loads it is black for a second, then grays itself out. (I believe the order must be different between Firefox and IE: Firefox reads the script first, sets the field to read-only, then reads the Field Style to set the color to black. IE reads the Field Style first, sets the color to black, then reads the script to set the field to read-only and grays it out.)
Is there a way to set the font color in a script so I can add this line of code after setting the field to read-only? I have only been able to find how to change the field label color, not the actual text inside the field. Any help here would be greatly appreciated.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2013 08:21 AM
Having the same problem. This code works with Firefox but not IE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2013 10:21 AM
This is currently working on demo009:
function onLoad() {
//Type appropriate comment here, and begin script below
window.setTimeout(function() {
$("sys_readonly.incident.u_test_field").style.color = "red";
},200);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2013 11:32 AM
How would I reference the caller's phone number field here? I am displaying the phone number on the incident form and want to change its color. I tried using $("sys_readonly.incident.caller_id.phone").style.color = "red"; but it gives me a script error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2013 07:22 AM
What script error are you getting? Which phone field are you showing (there are a couple)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2013 07:38 AM
When I use $("sys_readonly.incident.caller_id.phone").style.color = "red"; I get the following script error:
Error: Unable to get value of the property 'style': object is null or undefined