Changing background from a choice field and readOnly

hgzoia
Tera Contributor

Hi, 

I am new to coding on Now. Please show me what I need to do with my script to change a background based in a answer from a choice for choices field which is read-only. Is it possible to change the background with read-only enabled?

{

var field = g_form.getControl('u_field');
if(field){
if (newValue === 'red') {
field.style.backgroundColor = 'red';
} else if (newValue == 'green') {
field.style.backgroundColor = 'green';
} else {
field.style.backgroundColor = 'white';
}
}

}

 

Thank you, I would appreciate your help.

HOZ

0 REPLIES 0