Hi.
I am using Gravity forms 2.6.1 and I am trying to use country code as value following the docs recommendations gform_countries - Gravity Forms Documentation
When I try the following code:
add_filter(
'gform_countries'
,
function
() {
$countries
= GF_Fields::get(
'address'
)->get_default_countries();
asort(
$countries
);
return
$countries
;
} );
I get the following javascript error:
form_editor.min.js?ver=2.6.1:1 Uncaught TypeError: gform_predefined_choices[e].join is not a function
at SelectPredefinedChoice (form_editor.min.js?ver=2.6.1:1:62681)
at HTMLAnchorElement.onclick (admin.php?page=gf_edit_forms&id=1:4378:37)
Checking the code I realize that in form_editor.js the function SelectPredefinedChoice() expects gform_predefined_choices[name] to be an Array, but receives an Object instead ( cause of the [country_code] => “Country name”)
Not sure what I am doing wrong. Or if I am implementing this the wrong way?
Any hints appreciated.
Thanks.