Applying styles to the content of textarea

classic Classic list List threaded Threaded
8 messages Options
SD
Reply | Threaded
Open this post in threaded view
|

Applying styles to the content of textarea


I have the same instance pointing to mediatype="text/html" and no mediatype tag so that the user can either use the editor or key in direct html.

I used the 1st textarea to create the following message

CSS Example

Styles are not getting applied.

and the following code was generated in the 2nd textarea

CSS Example<br clear="none"/><br clear="none"/><b>Styles are not getting applied.</b><br clear="none"/><br clear="none"/>

My requirement is to grab this content as the email body and send an email.

Orbeon log shows me the following code for the email body

<html_body>CSS Example&lt;br clear="none"/&gt;&lt;br clear="none"/&gt;&lt;b&gt;Styles are not getting applied.&lt;/b&gt;&lt;br clear="none"/&gt;&lt;br clear="none"/&gt;</html_body>

And the email that I received had

CSS Example

It basically lost the content (Styles are not getting applied.)

Can anyone guide me on this.

regards
--SD


SD
Hi All,

I have a text area defined as follows

 <xforms:textarea ref="instance('email-content')" mediatype="text/html"/>
 <xforms:textarea ref="instance('email-content')"/>
Reply | Threaded
Open this post in threaded view
|

Re: Applying styles to the content of textarea

Erik Bruchez
Administrator
SD,

You don't say how you send the email, which seems to be the key here.

-Erik

On Thu, May 12, 2011 at 9:15 AM, SD <[hidden email]> wrote:

> Hi All,
>
> I have a text area defined as follows
>
> <td>
>  <xforms:textarea ref="instance('email-content')" mediatype="text/html"/>
> </td>
> <td>
>  <xforms:textarea ref="instance('email-content')"/>
> </td>
>
> I have the same instance pointing to mediatype="text/html" and no mediatype
> tag so that the user can either use the editor or key in direct html.
>
> I used the 1st textarea to create the following message
>
> CSS Example
>
> Styles are not getting applied.
>
> and the following code was generated in the 2nd textarea
>
>
> CSS Example<br clear="none"/><br clear="none"/>Styles are not getting
> applied.<br clear="none"/><br clear="none"/>
>
>
> My requirement is to grab this content as the email body and send an email.
>
> Orbeon log shows me the following code for the email body
>
> <html_body>CSS Example&lt;br clear="none"/&gt;&lt;br
> clear="none"/&gt;&lt;b&gt;Styles are not getting applied.&lt;/b&gt;&lt;br
> clear="none"/&gt;&lt;br clear="none"/&gt;</html_body>
>
>
> And the email that I received had
>
> CSS Example
>
> It basically lost the content (Styles are not getting applied.)
>
> Can anyone guide me on this.
>
> regards
> --SD
>
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Applying-styles-to-the-content-of-textarea-tp3518009p3518009.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
SD
Reply | Threaded
Open this post in threaded view
|

Re: Applying styles to the content of textarea

SD
Erik,

I have a jar file which has classes written in JAVA that sends the email. The html body is stored in the eXist database and this JAVA code reads the html body from the database and sends email.

Am I making sense?

Regards
--SD
Reply | Threaded
Open this post in threaded view
|

Re: Re: Applying styles to the content of textarea

Erik Bruchez
Administrator
Sure but it's hard to say much without knowing exactly how the data
captured by the HTML area ends up to your email library.

This said, often this kind of issues comes down to setting the proper
mediatype, or to escape/unescape markup.

-Erik

On Wed, May 18, 2011 at 7:19 AM, SD <[hidden email]> wrote:

> Erik,
>
> I have a jar file which has classes written in JAVA that sends the email.
> The html body is stored in the eXist database and this JAVA code reads the
> html body from the database and sends email.
>
> Am I making sense?
>
> Regards
> --SD
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Applying-styles-to-the-content-of-textarea-tp3518009p3532817.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
SD
Reply | Threaded
Open this post in threaded view
|

Re: Re: Applying styles to the content of textarea

SD
Hi Erik,

This is what is in the html body stored in the DB

Dear __EMPLOYEE_,<br clear="none"/>
<br clear="none"/>
Welcome to __COMPANY_NAME__. Please fill out this stack of paperwork.

I read this in Java as store it in a String object named body, then I append <html><body>+body+</body></html> tags.

Then I'm unescapingHtml using StringEscapeUtils.unescapeHtml(body) and setting the content type to "text/html"

I'm still lost on this.

Thanks
--SD

Reply | Threaded
Open this post in threaded view
|

Re: Re: Applying styles to the content of textarea

fl.schmitt(ops-users)
Just guessing: what happens if you put all the content of the "simple" textarea inside a
<div>
 element (either by inserting it manually in the textarea or by postprocessing the textarea input)? But if the problems are actually caused by a missing root element, i would expect an error message at any point of the "processing chain"...

fs
Reply | Threaded
Open this post in threaded view
|

Re: Applying styles to the content of textarea

fl.schmitt(ops-users)
In reply to this post by SD
SD wrote
(...)
I have the same instance pointing to mediatype="text/html" and no mediatype tag so that the user can either use the editor or key in direct html.
another suggestion: instead of using two xforms input controls, just use an editor component that allows for editing its content directly, in raw mode. i'm not sure whether the YUI RTE has such a feature included (IIRC it has but i can't find an example at the moment), but TinyMCE offers raw mode editing anyway.

HTH, florian
SD
Reply | Threaded
Open this post in threaded view
|

Re: Applying styles to the content of textarea

SD
Hi,

I figured out the problem, it was the Java code that was causing this

I was using XMLReader which is a SAX based parser and the parser interprets < and > and truncates it.
A workaround was to use the substring function.

Thanks a lot Erik and Florian.

regards
--SD