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.

Submitted content truncated (RGFormsModel::prepare_value)

  1. The prepare_value method in forms_model.php uses strip_tags() on fields that aren't "whitelisted" for HTML content. As a result, if someone submits content with a left angle bracket followed immediately by another character, this is interpreted as a tag and everything from this point is stripped from the input until a right angle bracket is found. There are times when users might use the left bracket followed immediately by another character in a non-code context (such as a "less than" comparison, which brought the issue to our attention). Furthermore, in some contexts (such as a support form) it might be desirable to allow users to submit any tags as non-interpreted text content. In this case, attempting to pass an exhaustive collection of allowed tags to the 'gform_allowable_tags' filter is an awkward and fragile solution.

    Using an escaping function such as esc_html() or esc_textarea() rather than strip_tags() would sanitize the content while preserving all user input.

    Posted 12 years ago on Thursday April 5, 2012 | Permalink
  2. You have a valid point and I am willing to consider it. I will run it by the team and see what the others say. As you know, this is a change that will affect every field, so we need to be careful when implementing it. It is not something we can just get done quickly.

    Posted 12 years ago on Friday April 6, 2012 | Permalink
  3. I understand--a lot of thought goes into changes like this. Thanks!

    Posted 12 years ago on Tuesday April 17, 2012 | Permalink
  4. CraigTommola
    Member

    How might I allow HTML in the confirmation message? I am using a modification in the functions.php file to generate a dynamic confirmation message and it appears strip_tags is removing my link from the type.

    See here for details:
    http://www.gravityhelp.com/forums/topic/adding-a-link-to-a-dynamic-confirmation-message

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  5. Craig, I am going to close this topic and focus the support on the topic you currently have open for this issue. Thank you.

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink

This topic has been resolved and has been closed to new replies.