Project

General

Profile

Actions

Bug #20288

closed

Eval of double2 doesn't work

Added by Steffen Kamper over 15 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2009-04-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.3
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If a field has eval double2 it should be result in a double with precision 2. This works for most values, but some not.
Example:

-1,75 => -1.75
12 => 12.00

but

0,75 => 0.75
,5 => 0.50

It's not possible to enter a value between -1 and 0

(issue imported from #M10861)


Files

10861.diff (1.54 KB) 10861.diff Administrator Admin, 2009-04-07 11:50
T3X_test_fields.t3x (9.95 KB) T3X_test_fields.t3x Administrator Admin, 2009-04-07 11:50
bug10861-v4.patch (3.55 KB) bug10861-v4.patch Administrator Admin, 2009-05-20 17:52
Actions #1

Updated by Steffen Kamper over 15 years ago

php-validation can be very simple:

$value = str_replace(',', '.', trim($value));
return number_format($value, 2, '.', '');

Actions #2

Updated by Steffen Kamper over 15 years ago

the same for JS:

var theVal = ''+value;
theVal = Number(theVal.replace(/,/g, "."));
theVal = theVal.toFixed(2);
return theVal;

Actions #3

Updated by Steffen Kamper over 15 years ago

added patch and test extension

Actions #4

Updated by Steffen Kamper over 15 years ago

committed to trunk, rev 5460 and 4_2, rev 5461

Actions #5

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF