Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Changing the font style

coolgirl
Mega Expert

Hello,

            I would like to know how to change the font style of selected field. I have written the below code in on change of 'font style' field (it has list of font styles), which does not seem to work.

function onChange() {

  var val = g_form.getValue('u_text');

  val.style.fontFamily= g_form.getValue('u_font_style');

}

Thanks,

Sam

1 ACCEPTED SOLUTION

OK... then use var style1 = g_form.getDisplayBox('u_font_style').value; instead of var style1 = g_form.getValue('u_font_style');




View solution in original post

13 REPLIES 13

Hi Tanumoy,


      It says bad assignment.I tried the following code ,it seems to work but is not changing the font style when i click on a different one



function onChange() {


  var style1 = g_form.getValue('u_font_style');


  g_form.getControl('u_text').style.fontFamily = style1;



}


u_font_style.. is it a drop down field?



If yes, could you please give a screenshot of the choices of it.


Font style is a reference field.



find_real_file.png


OK... then use var style1 = g_form.getDisplayBox('u_font_style').value; instead of var style1 = g_form.getValue('u_font_style');