neos / flow-development-collection

The unified repository containing the Flow core packages, used for Flow development.
https://flow.neos.io/
MIT License
138 stars 188 forks source link

double values for optionValueField not working #2225

Open CnczubehoerEu opened 4 years ago

CnczubehoerEu commented 4 years ago

Description

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.

Steps to Reproduce

getPrice() { return 1.234; }

Expected behavior

A select field with 1.234 as option value.

Actual behavior

A select field with 1 as option value.

Affected Versions

Neos:

Flow: 6.0.6

You can get this information by running composer show.

albe commented 3 years ago

The code where the is_float case is missing is https://github.com/neos/flow-development-collection/blob/5.3/Neos.FluidAdaptor/Classes/ViewHelpers/Form/SelectViewHelper.php#L240-L254