Skip to content

Commit

Permalink
Decimal support for FormHelper.
Browse files Browse the repository at this point in the history
  • Loading branch information
uzyn committed Sep 29, 2013
1 parent e527506 commit 091658a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/Cake/Test/Case/View/Helper/FormHelperTest.php
Expand Up @@ -354,6 +354,7 @@ class ValidateUser extends CakeTestModel {
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'balance' => array('type' => 'float', 'null' => false, 'length' => '5,2'),
'cost_decimal' => array('type' => 'decimal', 'null' => false, 'length' => '6,3'),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
Expand Down Expand Up @@ -1876,6 +1877,17 @@ public function testInput() {
);
$this->assertTags($result, $expected);

$result = $this->Form->input('ValidateUser.cost_decimal');
$expected = array(
'div' => array('class'),
'label' => array('for'),
'Cost Decimal',
'/label',
'input' => array('name', 'type' => 'number', 'id'),
'/div',
);
$this->assertTags($result, $expected);

$result = $this->Form->input('Contact.email', array('id' => 'custom'));
$expected = array(
'div' => array('class' => 'input email'),
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/FormHelper.php
Expand Up @@ -1147,7 +1147,7 @@ protected function _magicOptions($options) {
'boolean' => 'checkbox', 'timestamp' => 'datetime',
'text' => 'textarea', 'time' => 'time',
'date' => 'date', 'float' => 'number',
'integer' => 'number'
'integer' => 'number', 'decimal' => 'number'
);

if (isset($this->map[$type])) {
Expand Down

0 comments on commit 091658a

Please sign in to comment.