Using Syle to highlight a field

amacqueen
Mega Guru

The picture below shows what I've done to get a field highlighted based on the fields value

Style.PNG

I have a feeling that I may have got the syntax wrong as this field is a string and not an integer/choice field.

I would welcome any feedback.

TIA

1 ACCEPTED SOLUTION

Angus,


Use the below code:



function onChange(control, oldValue, newValue, isLoading) {


  var cTypeLabel = $('label.incident.contact_type');


  var cTypeField = $('incident.contact_type');



if (newValue == 'Self Service') {


  cTypeLabel.setStyle({backgroundColor: "red"});


  cTypeField.setStyle({color: "red"});


  }


  else {


  cTypeLabel.setStyle({backgroundColor: ""});


  cTypeField.setStyle({color: ""});


  }



}


View solution in original post

30 REPLIES 30

saritha9
Giga Expert

Can you explain what is the issue you are facing? Is the style not working?



Is content_type field available on Incident table?


The style is not working at all Saritha, apologies it should be contact_type and it is available on the form.



randrews
Tera Guru

in your query is "Site Surgery" the value of that field or the label for the value?


Style1.PNG


It is both, see above:-