Last active
February 4, 2020 22:22
-
-
Save scyt/2e76b3f7c95669dbf96cc0189304a490 to your computer and use it in GitHub Desktop.
Gravity Perks // GP Copy Cat // Last Item In List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
/** | |
* Gravity Perks // GP Copy Cat // Last Item In List | |
* | |
* Only copy the last item in a list field to the target field | |
* | |
* @version 1.0 | |
* @author Scott Buchmann <scott@gravitywiz.com> | |
* @license GPL-2.0+ | |
* @link http://gravitywiz.com/... | |
* @copyright 2020 Gravity Wiz | |
*/ | |
// Update "123" with target Field ID | |
gform.addFilter( 'gppc_copied_value', function( value, $elem, data ) { | |
if( data.target == 123 && value ) { | |
var lastIndex = value.lastIndexOf(' '); | |
value = value.substring(lastIndex + 1); | |
} | |
return value; | |
} ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment