Color Changing field based on the Choice

Lavanya11
Kilo Sage

I have a requirement of changing color of a field based on the select box. In a Custom form, there is a choice field. Based on the choice, two string fields has to change its color and shape. I am able to change the color by writing the client script( found somwhere in the community). But it is possible to change the shape?

 

var grValue = g_form.getValue("u_relevance");
var myField = 'u_document_status';
var myAudit = 'u_audit_status';
var ctrl = g_form.getControl(myField);
var ctrl_one = g_form.getControl(myAudit);
if(grValue == 1)
{
ctrl.style.fontWeight = 'bold';
ctrl.style.backgroundColor = 'Red';
ctrl_one.style.fontWeight = 'bold';
ctrl_one.style.backgroundColor = 'Red';
}
else
{
ctrl.style.fontWeight = 'bold';
ctrl.style.backgroundColor = 'Green';
ctrl_one.style.fontWeight = 'bold';
ctrl_one.style.backgroundColor = 'Green';

}


}

This script functions good. But normally the field will be rectangle in shape. Can I change it to round shape. Is it possible to do?

8 REPLIES 8

Bhaba
Tera Expert

Hi Lavanya,

 

in order to change the shape of a field, follow the below steps.

  • Right click on the field label in the form you want to change the size for and select 'Configure Styles'. 
  • Select 'New' to create a new style for that field. 
  • In the 'Style' section add the following code
height: 25px;
width: 25px;
border-radius: 50%;

Adjust the height and width accordingly.

This should work perfectly fine. Let me know if you're facing any issue.

 

Thanks.

It's working. But the width is not getting adjusted as per my expectations. However little changes happening

Hi Lavanya,

Can you share a screenshot of the changes you've made ? What value did you give for the height and width ?

Thanks.

find_real_file.png