Copy as Comma-delimited List

When copying multiple values to a single input, Copy Cat will join

Instructions

  1. Install this snippet with our free Custom JavaScript plugin. https://gravitywiz.com/gravity-forms-code-chest/

  2. Configure the snippet per the inline instructions.

Code

Filename: gpcc-copy-as-comma-delimited-list.js

/**
* Gravity Perks // Copy Cat // Copy as Comma-delimited List
* https://gravitywiz.com/documentation/gravity-forms-copy-cat/
*
* When copying multiple values to a single input, Copy Cat will join
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
*    https://gravitywiz.com/gravity-forms-code-chest/
*
* 2. Configure the snippet per the inline instructions.
*/
gform.addFilter( 'gppc_copied_value', function( value, $elem, data, sourceValues ) {
	// Update "4" to ID of the field that should be populated with commma-delimited values.
	if ( data.target == 4 ) {
		value = sourceValues.join( ', ' );
	}
	return value;
} );

Comments

  1. gahuml2
    gahuml2 September 8, 2025 at 12:29 pm

    This snippet cannot handle a text that contains “xxx”. For example, I have a list field where the option I want to copy to another field looks like this: • John “Brett” S.

    Help is appreciated.

    Reply
    1. J Yeager
      J Yeager Staff September 8, 2025 at 3:26 pm

      Hey,

      I just gave this a quick test locally, but it appears to be working okay for me when copying from a List field to a Single Line Text field. I’ll follow up with you via Support so we can understand your setup a little better and see why this isn’t working.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.