Using a client script to dynamically change a label makes required asterisk disappear

kb22
Kilo Contributor

Hi All,

I'm using a client script to alter the text label of a field.

var field = 'wfe_senior_director'; // wfe_senior_director is the database name for the variable

 var labelElement = $('label_' + g_form.getControl(field).id).select('label')[0];

   labelElement.innerHTML = "Who is the requested for's AVP or VP?";

 

The script functions correctly, but once the label is changed, the mandatory field asterisk is no longer visible.

Does anyone know how to fix this?

Kevin Brown

6 REPLIES 6

*Edited*  Actually I just got it to work fine on my Multi-line text field on the service portal.  Not sure if documentation is outdated or if it doesn't work for specific types of variables.

Megha Padale
Giga Guru

Hi,

You can use method setLableOf to set the plain text value of the field label.

  g_form.setLabelOf('comments', ' Who is the requested for's AVP or VP?');

If my answer helped you, mark answer as helpful and correct.

Thanks and regards,

Megha.