Use Country Code as Value issue

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.

Hi Victor. I recommend opening a support ticket for this issue:

https://www.gravityforms.com/open-support-ticket/technical/

Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.