Don't generate maxlength properties for decimal columns.

Int casting the decimal scale isn't going to work in a number of
situations as users may end up trying to include decimal points, commas
or spaces in larger amounts.

Fixes #5977
This commit is contained in:
mark_story 2015-02-27 21:08:54 -05:00
parent 54edb1cfa6
commit 8dba9879d4
2 changed files with 1 additions and 1 deletions

View file

@ -782,7 +782,6 @@ class FormHelperTest extends CakeTestCase {
'type' => 'text', 'type' => 'text',
'name' => 'data[ValidateUser][cost_decimal]', 'name' => 'data[ValidateUser][cost_decimal]',
'id' => 'ValidateUserCostDecimal', 'id' => 'ValidateUserCostDecimal',
'maxlength' => 6,
)), )),
'/div' '/div'
); );

View file

@ -1287,6 +1287,7 @@ class FormHelper extends AppHelper {
isset($fieldDef['length']) && isset($fieldDef['length']) &&
is_scalar($fieldDef['length']) && is_scalar($fieldDef['length']) &&
$fieldDef['length'] < 1000000 && $fieldDef['length'] < 1000000 &&
$fieldDef['type'] !== 'decimal' &&
$options['type'] !== 'select' $options['type'] !== 'select'
); );
if ($autoLength && if ($autoLength &&