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.

Merge tags - use part of a tag

  1. Hi

    I am not sure how to specify this and I have searched in support and cannot find an answer.
    I would like to use one of the merge tags that is sent via email and shorten that merge tag, e.g. one of my fields is called company name, I would like to use this merge tag, but only the first 8 letter/numbers. How could I do this?
    I am sure it is pretty easy.

    Edit: also IF possible remove any spaces, for example if the company name is AAB Limited that it would merge tag as AABlimit (8 characters after removing space)

    Thank you

    Posted 12 years ago on Monday September 24, 2012 | Permalink
  2. It's not super easy to do, and certainly cannot be done from the form builder, but can be done with some code in your theme's functions.php. What is your skill level with PHP?

    To strip the spaces out, then limit the text to 8 characters, you could do this with the gform_pre_submision filter: http://pastebin.com/Vk6JVSEK

    That will store the 8 character abbreviated company name in field 5 in your form, and you can use the in notifications if you need to. You will need to change the form ID, and the two fields IDs, the one where the long company name was entered and where the short 8 character name will be stored.

    Posted 12 years ago on Monday September 24, 2012 | Permalink
  3. Hi

    Sorry for the delay in the reply.
    I have been busy with other things.

    This Works fantastically!

    Thank you very very much.
    Perfect, just what I was looking for.

    Posted 12 years ago on Tuesday October 16, 2012 | Permalink

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