optionValueField with double => strange behavior => bug?

Hi!

I’m using Neos Flow 6.0.6. I would like to use the optionValueField-tag in my select-field.

<f:form.select property=“blubb” options=“{blub}” optionValueField=“price” />

When “getPrice()” returns a double value, the select form shows only one option and the value of the option is “1”. In my case, the double value was “1.36”. So, the “1” could be a rounded value.

When I’m using the function

getOptionValue() { return (string)$this->price; }

and

<f:form.select property=“blubb” options=“{blub}” optionValueField=“optionValue” />

everything is fine.

Is this a kind of bug or a feature?! :slight_smile:

Thanks for your help!

Best regards,

Tobias

That’s… a bug :smiley:

We only expect the value from optionValueField to be a string or an object that can be __toString()'d - so we effectively forgot it could be a (decimal)number.

Yes, it’s happened - I’ve found a bug :smiley: I’ve been of the opinion dozens of times that this must be a bug, but it was due to my unknowing :smiley:
Do I still have to report it officially somewhere?

Please add it as a issue on Sign in to GitHub · GitHub :slight_smile:

Done. Thank you!

Link Bot: https://github.com/neos/flow-development-collection/issues/2225 :slight_smile:

And thank you :slight_smile: If you want to be sure it will be fixed in for next release, you can provide a patch for it :slight_smile: Find information on these links

https://docs.neos.io/cms/contributing-to-neos/

Development workflow for GitHub

or join the Slack channel neos-project.slack.com/ :wave: