- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
12-28-2024 01:58 AM - edited 12-28-2024 01:59 AM
Many a times there is a requirement to add some css to variable label such as making bold.
I am sharing sample script for the same, you can enhance it as per your requirement.
You can use this catalog client script onLoad and make the Label variable as Bold
Script: This will work in both native + portal
1) Ensure Isolate Script field is set to false for this client script
2) This field is not on form but from list you can make it false
function onLoad(){
setTimeout(function(){
if(window != null){
// native
g_form.getControl('variableName').setAttribute('style', 'font-weight: bold;color:blue');
}
else{
// portal
var aTags = this.document.getElementsByClassName("ng-binding");
var searchText = "My Label"; // give the label name here
var found;
for (var i = 0; i < aTags.length; i++) {
if (aTags[i].textContent.toString() == searchText) {
aTags[i].style.fontWeight = 'bold';
break;
}
}
}
}, 3000);
}
Output:
Native:
Portal:
- 1,768 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
The above code is not working in Native UI. And also how to make this variable bold and red in RITM form?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Any kind of DOM manipulation is against best practices and should not be done. This kind of parctice is why so many instances get to an unusable state and firms have no choice but to start over with a new instance.
Just push back and say no, we cannot do this type of enhancement since it is against best practices.
