- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2016 03:07 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 12:40 AM
OK... then use var style1 = g_form.getDisplayBox('u_font_style').value; instead of var style1 = g_form.getValue('u_font_style');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2016 04:13 AM
Hi Sagar and Midhun,
Thanks for the input. But I would like the text to change depending on the font the user chooses.This can be done only though code i guess.
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2016 10:50 PM
Yes Sam, it is because i feel you have put the element id with a wrong value.
To get the element id of any field follow the below steps
1. Press F12 while opening your browser
2. Press the search icon in the browser console and hover over the element or the field which you want to change
3. You will see an id in the html code, just copy the id
4. Then use the code below
gel('<element id(to be replaced with the original id)>').style.font-family=g_form.getValue('u_font_style');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2016 11:30 PM
Hi arka,
I am still not clear on how to get the element id.When i press F12 in my laptop i get the option of keeping the wireless on or off. And I dont understand the below statement.
Press the search icon in the browser console and hover over the element or the field which you want to change.
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2016 11:45 PM
To get that right click on the page and then click on Inspect or Inspect Element.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2016 11:54 PM
Use val.style.font-family= "g_form.getValue('u_font_style')"; instead of val.style.fontFamily= g_form.getValue('u_font_style');