How to Italicize text in a switch case raw text value | Community
Skip to main content
Level 2
February 8, 2022
Solved

How to Italicize text in a switch case raw text value

  • February 8, 2022
  • 2 replies
  • 1443 views

Can anyone tell me how to italicize partial text in a switch/case statement of raw text (in the example, the text in uppercase)?

 

switch (this.rawValue){

    case "0":

        MyText.rawValue = "Text example one"

        break;

 

    case "1":

        MyText.rawValue = "Text example two, THIS TEXT TO ITALICS."

        break;

}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by webpointz1961

I solved the issue by creating multiple Text+ boxes with pre-filled text including text that is italicized, then made its presence "Hidden from layout".

When user selects the appropriate text box, it makes it "visible" and makes the others "hidden".

2 replies

Ravi_Pampana
Community Advisor
Community Advisor
February 8, 2022

Hi,

 

We can use Rich Text and restrict the plugins to only have B/I/U, so we can select a specific text to italic or if you want to achieve it only by Raw Html, you can try the below options.

 

1) Adding italic tags in the raw html text area and in sightly using context @3184128 will display the text in italic

 

 

  

Or add some special characters around the text which needs to be italic and replace that with <i> in java 

Or In java we can also check the character is caps and add the italic tag

Level 2
February 8, 2022

But to change it using javascript, if I put <i></i> tags around the text, they show in the text field as tags.

myText.rawValue = "Please note this <i>italicized text</i>"

 

Displays as 
Please note this <i>italicized text</i>

 

Text is being displayed programmatically depending on the selection from a dropdown list, it's not text being entered by user.

ibishika
Level 4
February 9, 2022

If you are trying this from Javascript you can tey using Jquery functions available. Check this link out: https://stackoverflow.com/questions/20267775/jquery-inserted-html-is-rendered-as-a-raw-text 

webpointz1961AuthorAccepted solution
Level 2
February 9, 2022

I solved the issue by creating multiple Text+ boxes with pre-filled text including text that is italicized, then made its presence "Hidden from layout".

When user selects the appropriate text box, it makes it "visible" and makes the others "hidden".