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.

Equivalent of str_replace() on specific field of form

  1. If this has been answered, I couldn't find it. On one specific field, I want to, basically, run a str_replace() to change an ampersand into the word 'and' upon submission. I don't want validation to report an error, I just want to handle it afterwards since the fields populate a GET URL.

    I know I can likely dive into the code and create some sort of conditional function, but I wanted to see if there was a hook/filter that would do this more efficiently. Thanks!

    Posted 13 years ago on Saturday June 11, 2011 | Permalink
  2. Probably the best time to do this would be the gform_pre_submission hook. If you put the contents of the $_POST variable you will be able to see which index stores the value you'd like to update and can run your str_replace() directly on the $_POST variable. Gravity Forms will then use the $_POST to generate the lead details for the submission.

    Posted 13 years ago on Sunday June 12, 2011 | Permalink
  3. That was incredibly easy. Thanks!

    Posted 13 years ago on Monday June 13, 2011 | Permalink