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.

Combine (Merge) Two Single Lines Text Fields Into One

  1. Say I have 2 fields: Field A and Field B. They are both single line text fields. I want another field, Field C which would also be a single line text field, to calculate Field A value + FieldB value resulting in a concatenated Field C value. I can't so far figure out how this works.

    Posted 6 years ago on Monday June 17, 2013 | Permalink
  2. Are these fields numbers?

    Posted 6 years ago on Wednesday June 19, 2013 | Permalink
  3. Hi Rob, no they are text strings. For example, "Home" + "Run" could go into a third field "Home Run". I want to collect a few values from the form and store them in a single field for later use.

    Posted 6 years ago on Wednesday June 19, 2013 | Permalink
  4. David Peralty
    Administrator

    You would have to use our pre_submission hook, and a hidden field that allows for dynamic population of a value. Then using PHP you could concatenate the two values and push them to the third field.

    Posted 6 years ago on Wednesday June 19, 2013 | Permalink
  5. This code snippet should do the trick for you:

    https://gist.github.com/spivurno/5816734

    So add two single line text fields and then a hidden field to your form. Set your hidden field to be able to populate dynamically and then simply place the merge tags into the dynamic population area and on form submission it will combine the fields into this hidden field.

    Posted 6 years ago on Wednesday June 19, 2013 | Permalink
  6. Cool! This looks like what I need to use, thanks guys!

    Posted 6 years ago on Thursday June 20, 2013 | Permalink
  7. David Peralty
    Administrator

    Best of luck!

    Posted 6 years ago on Thursday June 20, 2013 | Permalink

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