How to set a particular color for field.

coolsaurabh
Tera Contributor

I want that when a particular form open , color of a particular field should be red.

Ex:- On incident form I add a field name as color, Now I want its default value should be red.

1 ACCEPTED SOLUTION

Hi Sourabh,



You can achieve this by defining a field style on the "Color" field. Here is how you do :


1. Right click on the color field


2. go to Configure Styles.


3. Click on "New"


4. Select table where the field belongs.


5. Select the "Color" field in the Field name drop dow box.


6. In the Style field write this line: background-color:Red;


7. Submit.


You are done.



Happy Working !



Thanks,


Arnab


View solution in original post

14 REPLIES 14

coolsaurabh
Tera Contributor

Hi Bharath,



My question as follows :-



I have created a field on incident table name as color. Now I want red color in the field by default.


Screenshot has been attached.




Color.jpg



Red color should be come in box with circle.


Write an onload client script making the field to be setted with the value of red on load


here you go



//tested


function onLoad() {


    //Type appropriate comment here, and begin script below


  var elementID = gel("incident.u_colour");


          elementID.style.backgroundColor = "red";


       


}



find_real_file.png


Regards
Harish

Hi Sourabh,



Go to Configure All --> Styles --> Select Table --> Set Field name = Color --> Style = background-color:red


Hi Sourabh,



As mentioned you can define that in style for that field and table, Navigate to System UI > Field Styles , select table as Incident , field as color and write script as below



background-color:red;



If you don't want any value leave value as blank.field.PNG