- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2023 12:09 PM
Hi Community
I have an HTML field "Introduction" on knowledge form. I have set the default font style as Tahoma and font size 12 pt.
This is done by updating the dictionary default value:
<p><span style="font-family: tahoma; font-size: 12pt;"> </span></p>
This is working fine on most knowledge templates but there is 1 template where we are setting some prepopulated text in this field via on load client script due to which the default style changes to Verdana and font size to 8 pt.
Below is the client script:
function onLoad() {
//Type appropriate comment here, and begin script below
var base = g_form.getValue('kb_knowledge_base');
var versionValue = g_form.getValue('version');
if(base == '42a1f18647dc9d50da21ebbd436d432e' && versionValue=='')
{
g_form.setValue('short_description', 'How to');
g_form.setValue('u_kb_introduction', 'This article');
}
is there a way to fix this font problem? i tried several ways however it does not seem to work:
//var element = g_form.getControl('u_kb_introduction').getElement();
var element = document.getElementById('u_kb_introduction');
// Set the font style
element.style.fontFamily = 'Tahoma';
element.style.fontSize = '12px';
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2023 12:44 PM
You need to add the HTML that sets styles to the field's value, not to the control that hosts the HTML.
g_form.setValue('u_kb_introduction', '<p><span style="font-family: tahoma; font-size: 12pt;">This article</span></p>')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2023 12:44 PM
You need to add the HTML that sets styles to the field's value, not to the control that hosts the HTML.
g_form.setValue('u_kb_introduction', '<p><span style="font-family: tahoma; font-size: 12pt;">This article</span></p>')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2024 10:02 AM
I have the same requirement as the OP, However when I use the set value code above, it does set the font to the correct size on the form load(since the code is on onload) but the moment when I start typing in the html field , it goes back to a different size.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2024 11:01 AM
What is the value that you are setting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2024 01:29 PM
I am setting the below in form's page on load client script.
g_form.setValue('u_kb_introduction', '<p><span style="font-family: tahoma; font-size: 12pt;">This article</span></p>')