Page 1 of 1

Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Thu Nov 06, 2014 12:12 pm
by pjamourik

Hi Guys,

I have a service with one particulair field which returs HTML. This field is bound to a Label component.

The HTML is shown as text instead of HTML :

Image

I just upgraded the project to the new version. Before the upgrade everything worked fine (HTML was displayed correctly).

Can you please help?

Thanks, kinds regards,

Peter


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Thu Nov 06, 2014 3:07 pm
by Evgene Karachevtsev

Peter,

Please add this handler to the mapping of component html:
pre$(element).html(value);/pre


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Mon Mar 16, 2015 5:52 am
by andi

Hello I have the same problem

Before i used following in the mapping
code
return '<a href="tel:'+value+'"><font color="#000000"> '+value+'</font></a>';
/code

for changing the telnumber into a clickable telnr, before update all works now i see the HTML Code

If i cahnge it into
code$(element)&#46;html('<a href="tel:'+value+'"><font color="#000000"> '+value+'</font></a>');/code

than i see the nornmal value, the html code is ignored
What i am doing wron?


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Tue Mar 17, 2015 4:36 am
by Yurii Orishchuk

Hi Andi,

Please show us some screen shots of your implementation.
And what you get as result.

Thanks.


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Tue Mar 17, 2015 5:17 am
by andi

Yes, please remeber before upgrading my project (i think 3-5 month ago all worked fine, the Label component showed correctly the HTML Content - after upgrade all my components didn't work - i have many of them ... :( )

Image

Image

Image


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Wed Mar 18, 2015 11:04 am
by Egor Kotov6832188

Hello Andi,

try next:
element.innerHTML = "YOUR_HTML_GOES_HERE";


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Wed Mar 18, 2015 11:17 am
by andi

No didn't work

I think the value will be overwritten from the default handler ...

can i write some code to prevent the default handler setting the text after leaving my mapping function?


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Thu Mar 19, 2015 4:43 am
by Yurii Orishchuk

Hi Andi,

Please try following code:

precode

var html = '<a href="tel:' + value + '"><font color="#000000"> ' + value + '</font></a>';

var onDelay = function(){
element&#46;html(html);
};
window&#46;setTimeout(onDelay, 1);

/code/pre

Regards


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Thu Mar 19, 2015 5:53 am
by andi

Hmmm ok, its a workaround

but will it be first set the label filled with the HTML Code and with a delay from 1 milisecound the correct value?


Can I make a service with HTML response render HTML instead of Text inside a label field?

Posted: Fri Mar 20, 2015 5:27 am
by Yurii Orishchuk

Hi Andi,

It just simple for you solution.

If you want a solution without delay - you can do following:

  1. Delete link and code from to that label.

  2. On "iteration" link from $ to your component click "JS".

  3. Use some sort of JS code like:

    pre

    &#47;&#47;where someAttribute is your goal response attribute&#46;
    element&#46;find('[name="yourLabelName"]')&#46;html(value&#46;someAttribute);

    /pre

    Regards.