PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Preserving newlines in a field populated pre-submission.

  1. mcarnevale
    Member

    Hey guys,

    I have a form field (hidden) that is being populated with the formatted contents of a cookie using the gform_pre_submission_filter.

    It has a collection of items, each with a subset of configurations. The issue I'm having is that I can't figure out how to keep any sort of line breaks in the data.

    I've tried html, it's stripped out. I've tried \n - the backslash is pulled and there's just n's listed in the data.

    Is there any way to either : insert HTML or newline characters that are preserved in the entries / emails? I assume that it's a security issue blocking these, but since it's being completely build in PHP on the back end, can I at least disable the stripslashes / remove html that's being triggered on this field?

    EDIT: I've solved this myself, due to a bit of forgotten php weirdness.

    '\n' is not "\n", as single quotes don't parse contents. Using doubles worked fine.

    Posted 6 years ago on Wednesday May 8, 2013 | Permalink
  2. David Peralty
    Administrator

    So you've figured this out? Let us know. All my best!

    Posted 6 years ago on Wednesday May 8, 2013 | Permalink