0

using the EE "email to friend" form, I need to include the contents of a WYGWAM field in a hidden form field. here's what that looks like:

<input type="hidden" name="message[]" value="{title}{product_description}" />

the {product_description} field is WYGWAM content and contains links. the quotes in the links (<a href="...") are breaking the formatting of the page because the browser reads the first href=" quote as the closing quote for the hidden field value. it's a quick fix to just change the hidden field attributes to single quotes but then it breaks the formatting if the {product_description} contains single quotes...

what's the best way to avoid that?

0

You need to strip all HTML from that content, and convert the quotes to entities. That email is going to be sent as plain text by the Tell-A-Friend form, so you'll need to remove all the HTML anyway.

Take a look at CE String - worth the small investment. You'd do something like this:

{exp:ce_str:ing removehtml htmlentities}{title}{product_description}{/exp:ce_str:ing}

Or, enable PHP in your template (on output):

<?php echo strip_tags(htmlentities("{title}{product_description}")); ?>
3
  • is that the only way to strip HTML from that content? btw, the tell-a-friend form does send HTML emails!
    – P..
    Apr 15 '14 at 1:25
  • Just updated my answer. Apr 15 '14 at 17:55
  • thank you. works nicely. and I bought CE String just in case :-)
    – P..
    Apr 15 '14 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.