Skip to content

Commit f4a72dd

Browse files
authored
gpcc-copy-comma-delimited-value-to-checkbox.js: Created a new snippet.
1 parent d3572f7 commit f4a72dd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Gravity Perks // Copy Cat // Copy Comma-delimited Value to Checkbox Field
3+
* https://gravitywiz.com/documentation/gravity-forms-copy-cat/
4+
*
5+
* Use Copy Cat to check the checkboxes in a Checkbox field based on a comma-delimited value
6+
* from a single-value field (like a Single Line Text field).
7+
*
8+
* Instructions:
9+
*
10+
* 1. Install this snippet with our free Custom JavaScript plugin.
11+
* https://gravitywiz.com/gravity-forms-custom-javascript/
12+
*/
13+
gform.addFilter( 'gpcc_copied_value', function( sourceValues, $targetElem, field ) {
14+
// Update "3" to your Checkbox field ID.
15+
if ( field.target == 3 ) {
16+
sourceValues = sourceValues[0].split( ', ' );
17+
}
18+
return sourceValues;
19+
} );

0 commit comments

Comments
 (0)