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.

trimming spaces from name and email field values

  1. I am using Gravity Forms to pass data to another application, which takes a person's first and last name and email address and creates a new user. However, this fails when a user accidentally enters a space after their name or email address. Is there an easy global filter I can use to trim trailing spaces from values submitted into those fields? I noticed in one of your changelogs you mention doing this on a number field, but apparently name and email fields aren't trimmed? Thanks in advance for your help.

    Posted 11 years ago on Friday June 7, 2013 | Permalink
  2. If you are passing data to another application using a PHP customization you can easily trim the values. If you are passing it via the query string then it's a bit more of an issue. It appears we aren't trimming spaces on the values. But we probably should so i'll create a ticket for it. Now there MAY be technical reasons why it does not do so automatically, so while i'll create a ticket for it… it's not a 100% guarantee that it'll be applied globally.

    But if you're not passing data to another application via PHP and can't simply trim the value then, you could definitely do it when the form is submitted. Get the existing field value, trip the extra spaces, store the value. So it could be done as a customization until we implement it as default behavior.

    It's never done it and in 4+ years this is the first time it's come up. Which surprises me. But it's the first time someone has asked about it. Is this something you'd need help writing a code snippet for?

    Posted 11 years ago on Monday June 10, 2013 | Permalink
  3. Thank you. I'm passing name and email values via a query string redirect to a second form and to cookies set from the query string. Then I use a custom php filter and function to trim and md5 the cookie values to create a key and populate the second confirmation form, which then sends a query string with the key on to an external app. The space creates a + sign in the cookie that does not get trimmed and causes the key to fail. I would need the trimming to be done immediately on submit. While I did create the code in my custom functions file based on documentation I found here, I would very much appreciate help with that code!

    Posted 11 years ago on Monday June 10, 2013 | Permalink
  4. Sounds good, would you mind submitting a priority support form for me and I can get it over to the dev team to take a look at with you:

    http://www.gravityhelp.com/priority-support/

    Posted 11 years ago on Monday June 10, 2013 | Permalink