Using a client script to dynamically change a label makes required asterisk disappear
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2018 08:02 AM
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
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2020 08:14 PM
*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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2020 09:35 PM
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.