Opened 6 years ago

Last modified 5 years ago

#1258 assigned defect

midcom.helper.datamanager2: big floats are displayed incorrectly

Reported by: flack Owned by: piotras
Priority: major Milestone: 8.09.10 Ragnaroek
Component: MidCOM component Version: 8.09 Ragnaroek
Keywords: Cc:


If I have a large float value like 2900000, it is displayed f.x. in DM2 edit forms as 2,9E+6. If I try to save the edit form, I get the error "This is no valid number.".

For easier handling, it would be better if midgard core could ensure that all floats are in normal decimal notation when passing them to the php object

Change History (6)

comment:1 Changed 6 years ago by piotras

  • Milestone changed from 8.09.6 Ragnaroek to 8.09.7 Ragnaroek

comment:2 Changed 5 years ago by piotras

  • Status changed from new to assigned

Please, explain "normal decimal notation".

comment:3 Changed 5 years ago by indeyets

It is definitely not Midgard Core (which returns double-type, not formatted string). It's either midgard-php or or even midcom

comment:4 Changed 5 years ago by flack

To reproduce add the following to the schema.xml:

    <property name="floatfield" type="float" dbtype="double" />

Add this to the DM2 schema:

        'floatfield' => array (
            'title' => 'Float Field',
            'storage'    => 'floatfield',
            'type' => 'number',
            'type_config' => Array
            	'precision' => 2,
            'widget' => 'text',

Create a new object onsite using datamanager. Enter "2900000" into the floatfield input field. Save.

Edit the newly created object onsite using datamanager. floatfield is prefilled with "2,9E+6". Click on save without making any changes. Datamanager will refuse to save and output "This is no valid number."

I'm sure "normal decimal notation" is not the correct term, but what I was trying to say is that the number shold be outputted in a format that DM2 (and users) can understand, so in this case 2900000 would be nice.

comment:5 Changed 5 years ago by flack

BTW: phpMyAdmin shows the value as 2,9E+6 as well, so this might be an optimization that MySQL does. Maybe this just needs fixing in the DM2 type and widget

comment:6 Changed 5 years ago by indeyets

  • Component changed from Midgard Core to MidCOM component
  • Summary changed from big floats are displayed incorrectly to midcom.helper.datamanager2: big floats are displayed incorrectly

It's not midgard-core's fault — It's php.

Here's little test (I use 64-bit system, so had to use larger number):

$fl = 2900000000000000000000;



so, moving to datamanager

Note: See TracTickets for help on using tickets.