This discussion is archived
6 Replies Latest reply: Nov 19, 2012 11:05 AM by asmirnov RSS

embed HTML tag in text message

asmirnov Newbie
Currently Being Moderated
Hi,
Can I embed any HTML text into for example VO query as in

SELECT '<HTML><F O N T C O L O R = " R E D ">'||NAME||'< / F O N T></HTML>' FROM EMP

?

I tried but it is not working, I am just getting

<HTML><F O N T C O L O R = " R E D "> JOHN </ F O N T></HTML>

on the page.

just wondering if somebody else had more success?

Thank you

Anatoliy

Edited by: asmirnov on Nov 18, 2012 8:04 PM

Edited by: asmirnov on Nov 18, 2012 8:05 PM
  • 1. Re: embed HTML tag in text message
    Gyan Darpan Guru
    Currently Being Moderated
    Hi,

    You need to create a item of type formatted text. And then set this vo attribute to it.

    Formatted text will process the HTML tag, while rendering on browser.

    Regards,
    Gyan
  • 2. Re: embed HTML tag in text message
    asmirnov Newbie
    Currently Being Moderated
    Gyan, thanks for looking.

    It looks like you are correct, but I am still having problem. I tried 2 ways.
    1. I tried in the VO sql query itself as
    SELECT '<html><fon t color="red">'||NAME... FROM EMP
    - nothing happend

    2. I also tried in the Property inspector to set the View Attribute value say instead of
    Name
    to be
    <html><fon t color="red">Name</fon t>
    (spaces here are interntinal to render on OTN)

    In this case the VO value just dissapered, only prompt remained on the page. I did try the same for prompt actually but it didn't make a difference.

    Do you know the correct syntax and place to do it?

    Thank you
    Anatoliy
  • 3. Re: embed HTML tag in text message
    Gyan Darpan Guru
    Currently Being Moderated
    Anatoliy,

    Your requirement is to display the data in HTML format based on the value returned from the query.

    Correct me if i m wrong.

    Regards,
    Gyan
  • 4. Re: embed HTML tag in text message
    Swati Explorer
    Currently Being Moderated
    Hello,

    You can display HTML formatted text using RawText bean. Set its ViewAttribute value.

    For SQL: I dont think you need to mention html and other optional tags....you can simply use tags like following:
    *<btag>SAMPLE TAG</btag>*

    I have tested your code using RawText bean...its working fine for me..
    -----
    OARawTextBean rawTxt = (OARawTextBean)webBean.findChildRecursive("rawTxtId");
    *if(rawTxt != null){*
    rawTxt.setValue(pageContext,"<HTML><FONTtag COLOR = '<your color name>'>JOHN</FONT></HTML>");
    *}*
    -----

    Regards,
    Swati
  • 5. Re: embed HTML tag in text message
    asmirnov Newbie
    Currently Being Moderated
    Gyan,
    I just want to change the font of VO attribute text value when it is rendered on the page.
    As an example say the VO has statement like SELECT name, department FROM emp WHERE ....
    A page has 2 message text fields
    Name prompt: <NAME>
    Department prompt: <DEPARTMENT>
    I want to change the font for the <NAME> text value so for example the color is red.
    I probably could do it better with attribute sets but I just wanted to have a shortcut.

    Thank you
    Anatoliy
  • 6. Re: embed HTML tag in text message
    asmirnov Newbie
    Currently Being Moderated
    Swati,

    Thanks for looking, let me try this.
    Of course the string "JOHN" in the example was just for clarity, the value will be supplied by the VO attribute at run time. But I guess this should work

    Regards,

    Anatoliy

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points