Skip to content

Commit 75fdcb5

Browse files
authored
gpadvs-caret-position.js: Added snippet to include Caret Position with GPAS.
1 parent 5384df1 commit 75fdcb5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Gravity Perks // Advanced Select // Caret Position
3+
* https://gravitywiz.com/documentation/gravity-forms-advanced-select/
4+
*
5+
* Adds Caret Position to GP Advanced Select fields.
6+
*
7+
* The Caret Position is a built in plugin of Tom Select.
8+
* @reference https://tom-select.js.org/plugins/caret-position/
9+
*
10+
* Instructions:
11+
*
12+
* 1. Install this snippet with our free Custom JavaScript plugin.
13+
* https://gravitywiz.com/gravity-forms-code-chest/
14+
*/
15+
window.gform.addFilter(
16+
'gpadvs_settings',
17+
function(settings, gpadvsInstance, selectNamespace) {
18+
/**
19+
* Scope to only multiselect fields.
20+
*/
21+
if (gpadvsInstance.fieldType === 'multiselect') {
22+
settings.plugins.caret_position = {
23+
title: 'Caret Position',
24+
};
25+
settings.plugins.input_autogrow = {
26+
title: 'Input Autogrow',
27+
};
28+
}
29+
30+
return settings;
31+
}
32+
);

0 commit comments

Comments
 (0)