Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Anyone know if it is possible to code so that a portion of text is bolded, but not the whole line?

Avatar

Level 3

Here is what I have:

I have a drop-down list that, when a selection is made, outputs two separate lines of text to two different cells. (By the way, I'm using LiveCycle Designer ES). I want one word in the string of outputted text for one field to be bold, but the rest regular text.

Here is a fake example to give you the idea:

case "1": // Walls in bad repair

    row2.box2 = "Correction: Fix the walls.";

    row1.box3 = "C";

    break;

Basically, I'd like the "Correction: " part to be bolded, but the "Fix the walls." part to be regular text.

It won't be tragic if it can't be done, but I'm trying to have my report form look as much like the old paper version in terms of text formatting.

Any takers?

DE

4 Replies

Avatar

Level 10

Hi Dave,

I don't think you can change the style of a textfield for part of the value.If you set the textfield to "Rich Text", then at run time the user can select a portion of text and change it to bold (Control + B0. But this is probably not what you want.

Someone may have that solution for you, in the meantime you could try the following.

For box2 textfield, turn the caption on and left aligned. Delete the default caption in the Object/Field tab and leave it blank.

Then your script would look something like this:

     case "1": // Walls in bad repair

     row2.box2.caption.value.#text = "Correction:";

     row2.box2.rawValue = "Fix the walls.";

     row1.box3.rawValue = "C";

     break;

It means that you would have to size the reserve for the textfield to match the largest string e.g. "Correction:". But you can set the caption of the textfield to Bold, while maintaining the textfield value to normal. In the Font tab, select the "Edit Caption Only" option:

Good luck,

N.

Avatar

Level 4

The only way o know of doing that is by using floating fields. But floating fields are only available on Text objects (not textfield or drop down). You can assign a diferent style to the floating field.

Avatar

Level 3

Thanks Niall and Rui for your input.

Niall, I think that is an elegant solution. I didn't even think to use captions. Depending on what our program wants to do, I may use that approach.

If anyone else knows if there is some other way to get the same thing, let me know.

Peace,

Dave

Avatar

Former Community Member

You would have to create the input the field as XHTML and import that value into the field for rich text to be interpretted on the fly.

Paul