Screen - Set label on elements with load script

Hello, 

I've created a screen with different elements. 
So far i've set label on each element through simple values, but i want to set everything programmatically on screen load. 
I've managed to set it on the FormPage-element, but it doesnt look like it works on for example a text-element: 



//Form Page
HtmlElement fp = getHtmlElement("FormPage");
fp.setFieldValue("label", MapValue(getLanguageVariable("order_header")));

//FacilityInfo
HtmlElement fi = getHtmlElement("FacilityInfo");
fi.setFieldValue("title", MapValue("test"));

//Project name
HtmlElement pname = getHtmlElement("pname");
pname.setFieldValue("label", MapValue("test"));

Result: 


Shouldnt it be exactly the same for all element-types, as long as you are able to set the label through simple values on the element directly? 

//Eivind

RE: Screen - Set label on elements with load script

Hi Eivind,

Sorry, nope. The different components are supporting different stuff via setFieldValue(). If you want to set labels programatically, you should either prepare something in the construction script (locally for each element, or in the global one which is executed first). Or you can create HtmlElements completely dynamically instead.

Sverre

By: Sverre Hjelm 3 May 2021