How to convert CRLF to <br /> in email body?

Topics: Administration, Customizing Orchard, General
Oct 13, 2012 at 9:06 PM

Almost there! I've set up a contact form with custom forms and added a rule to send an email. So far, so good.

However, one of the fields - bericht - is a textarea.

This field is included in the email body:

<p>{Content.Fields.FormBestelling.Bericht}</p>

However, I need to convert CRLF to <br> to keep the users formatting. How do I do this?

I found {Text.LineEncode} but I'm not sure how to use this...

 

 

Coordinator
Oct 13, 2012 at 9:35 PM
Edited Oct 13, 2012 at 9:38 PM

If the token you are using is correctly returning a text token, then you just chain .LineEncode and that's it. So that would be {Content.Fields.FormBestelling.Bericht.Value.LineEncode}

Oct 14, 2012 at 7:46 PM

Bertrand,

This is not working for me.

The token is a text field, don't know if you considers this different than a text.

{Content.Fields.FormBestelling.Bericht} show the text, but with CRLF's removed.
{Content.Fields.FormBestelling.Bericht.Length} shows the correct length (Length is defined in the overview as {TextField.Length}).
{Content.Fields.FormBestelling.Bericht.LineEncode} shows nothing (LineEncode is defined in the overview as {Text.LineEncode}).

So I guess there is a difference between Text and TextField. I thought .Value would get me the Text inside the TextField, but this seems not to be the case...

{Content.Fields.FormBestelling.Bericht.Value.LineEncode} shows nothing.

Tried to debug myself, but the code is so overwhelming.

Any suggestions...?

Coordinator
Oct 14, 2012 at 10:33 PM

It's a text field, but not a text token, which would be a bug. Please file it in the issue tracker.

Coordinator
Oct 17, 2012 at 12:21 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.