Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS error for Select option with number value #805

Open
grappler opened this issue Nov 30, 2018 · 0 comments
Open

JS error for Select option with number value #805

grappler opened this issue Nov 30, 2018 · 0 comments

Comments

@grappler
Copy link
Contributor

When using these two configurations I get an JS error in the console: Uncaught TypeError: data.value.split is not a function

[
	'label'   => esc_html__( 'Zoom', 'static-map' ),
	'attr'    => 'zoom',
	'type'    => 'select',
	'options' => range( 1, 22 ),
],
[
	'label'   => esc_html__( 'Zoom', 'static-map' ),
	'attr'    => 'zoom',
	'type'    => 'select',
	'options' => array_combine( range( 0, 22 ), range( 0, 22 ) ),
],

The reason for this is that the data.value has a typeof number instead of string in these cases.

If I change the code to the following it works fine.

[
	'label'   => esc_html__( 'Zoom', 'static-map' ),
	'attr'    => 'zoom',
	'type'    => 'select',
	'options' => array_combine( range( 1, 22 ), range( 1, 22 ) ),
],

Related change #745

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant