Expand my Community achievements bar.

How to bold a one word in a textfield

Avatar

Level 7
I would like to bold a few randomn words in a sentence used as a rawvalue in a textfield.



e.g. "This
word should be bold"



Does someone know how to acheive the above through scripting



Thank you in advance



Aditya
8 Replies

Avatar

Level 10
Hi Aditya,



I am not sure if this is much help to you. I do not know how to script what you are looking for.



However you can change the field format for each of the textfields. In LC Designer 8.2 select the textfield and go to the Object / Field window. Then change the Field Format from "Plain Text Only" to "Rich Text". When using the PDF form, you can change the format of the whole textfield or individual words. For example "Control + B" will give you bold text, "Control + U"; underline, "Control + I"; italic. When a field is active you can press "Control + E" and this will allow you to change the font type and size, etc.



If you are using an earlier version of LC Designer, then you have to make two changes in the Object window. From memory one is in the Field tab and the other in the Binding tab.



Good luck,



Niall

Avatar

Former Community Member

I'm having the same issue.  I'd like to have a single word bolded, and I need to accomplish this using a script.  I can find references online to a JavaScript bold method, but I'm at a loss as to how it is applied in LiveCycle.  Anyone have any ideas?

Avatar

Former Community Member

Hi Guys,

I wrote a blog entry on how to do this. It's basically around how to set rich text content into a field. This is little tricky and all of the info that you need can be found at

http://blog.pandyaparth.com/?p=65

There is a sample there as well to help you guys.

regards,

Parth Pandya

http://blog.pandyaparth.com

Avatar

Former Community Member

Thanks for your help!  It looks like this will do what I need.  Question-is it necessary to import the XML data from somewhere else?  I've cut down the script so the only part I'm using is

txtOutput2.value.exData.loadXML(exdataTemplate.rawValue,1,1);

but I'd prefer it if I didn't have to have a text field floating around my form for the sole purpose of holding XML data.  Is it possible to put the XML data in the script editor and get it to work?  Is some command other than loadXML necessary?  Thanks

Avatar

Level 1

Hi parth pandya and all:

I was able to do this; however, how do I add a tab to my text?  I tried   but it didn't work.  Thanks.

Mike

Edit:

Figured it out, just used javascript on form ready,

  1. this.para.textIndent="50px";

Avatar

Level 3

This only will make it move to right by 50 pxl , if it is zero then the text is in the center (i.e) it is text alignment not style