Skip to content

Commit 1372794

Browse files
authored
gpadvs-enable-add-new-option.js: Updated with a example of how to customize "Add New" option.
1 parent 6b92202 commit 1372794

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

gp-advanced-select/gpadvs-enable-add-new-option.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,23 @@
1313
* NOTE: This step is not required if you are dynamically populating choices via Populate Anything.
1414
*/
1515
gform.addFilter( 'gpadvs_settings', function( settings, gpadvs ) {
16-
if ( gpadvs.formId == GFFORMID ) {
17-
settings.create = true;
16+
17+
if ( gpadvs.formId != GFFORMID ) {
18+
return settings;
1819
}
20+
21+
settings.create = true;
22+
23+
/**
24+
* Uncomment the below code to customize the display of the "Add New" option.
25+
*/
26+
// if ( ! settings.render ) {
27+
// settings.render = {};
28+
// }
29+
30+
// settings.render.option_create = function( data, escape ) {
31+
// return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
32+
// }
33+
1934
return settings;
2035
} );

0 commit comments

Comments
 (0)