I change the variable's label dynamically -> works, but the mandatory asterik mark is disappearing

JohnDF
Mega Sage

Hi everyone,

I'm changing the "Question" label variable using an onload script with this code. It works, but it removes the red asterisk. Is there a solution to keep the asterisk there? The field is still mandatory, but the red asterisk is disappearing.

Thanks for your help.

 

 

function onLoad() {
   //Type appropriate comment here, and begin script below
   
    var field = 'location'; // location is the database name for the variable


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


    labelElement.innerHTML = 'Standort für den Barcode-Handscanner'; // 'Standort für den Barcode-Handscanner' is the label name.

    
}

 

 

 

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

This elicits the question why? What is the use case for creating unsupported and not recommended code that will not work in Service Portal, Employee Service Center, or workspaces?  There doesn't seem to be anything dynamic about this script - if you are always changing a variable label when a form loads, why not change it in the variable definition instead?