Page 1 of 1
How to put Html text in TextArea Component
Posted: Fri Mar 22, 2013 6:35 pm
by leonardo
I want to show story text when a name or picture is clicked in the app. I have created a detail page for this with a Textarea component named "detailedText" and a Back Button in the Header. The text I want to show is contained in xml node elements like so:
code<story>
<H1>The Story of Paul</H1>
<pic>Paul.jpg</pic>
<p>This is line 1 of Paul's story</p>
<p>This is line 2 of Paul's story</p>
<p>This is line 3 of Paul's story</p>
<p>Line 4 of Paul's story has <g>a link</g> inside of it</p>
</story>/code
What do I need to do to be able to show all the items as Html inside the component on the page?
How to put Html text in TextArea Component
Posted: Fri Mar 22, 2013 6:55 pm
by Maryna Brodina
Hello! If you change your text to look like standard html you can map that text to Panel component.
How to put Html text in TextArea Component
Posted: Fri Mar 22, 2013 7:08 pm
by leonardo
Hi Marina. My thinking is to convert this as Html on the fly, as needed and then send it to the component to be rendered. That is doable, right?
How to put Html text in TextArea Component
Posted: Sat Mar 23, 2013 6:19 pm
by leonardo
Please I really need help on this.
How to put Html text in TextArea Component
Posted: Sun Mar 24, 2013 3:05 pm
by maxkatz
Maybe, you would need to write or find some JavaScript to do that.
How to put Html text in TextArea Component
Posted: Mon Mar 25, 2013 6:02 am
by leonardo
Thanks, Max. Maybe my question was vague. My question is not how to convert the elements to Html. My question is what is the Tiggzi code for extracting the element from the REST service so I can convert it to Html. Since Tiggzi is heavily UI oriented and simplifies things that way, I also need to know the Tiggzi code to pass the HTML to the Panel component to be displayed after it has been converted. thanks.
How to put Html text in TextArea Component
Posted: Mon Mar 25, 2013 6:47 am
by Maryna Brodina
Hello! You can add JS to mapping. Received value would be sent to that JS in variable "value". After converting this value to HTML you would need to return new value using "return" function - use return convertedValue; after all conversion.
How to put Html text in TextArea Component
Posted: Mon Mar 25, 2013 11:38 am
by leonardo
Hello! One of my confusion is where to put the JS. I know you can add JS to Request that you have mapped to. But since I couldn't map the node to any component:
- Where would I add the JS?
- Would the value equal or the whole XML?
How to put Html text in TextArea Component
Posted: Mon Mar 25, 2013 12:54 pm
by Maryna Brodina
1) You can add JS to Response too - transmitted value will be in "value" variable (http://docs.tiggzi.com/documentation/... see Mapping JavaScript section)
2) It depends on your mapping - you can map either whole XML or separate field
How to put Html text in TextArea Component
Posted: Mon Mar 25, 2013 6:25 pm
by leonardo
Thanks Marina. That's what I'm looking for.