Merge pull request #4565 from tractorcow/pulls/3.2/fix-numeric

BUG Remove html5 number field due to insufficient localisation support
This commit is contained in:
Ingo Schommer 2015-09-01 13:18:06 +12:00
commit d66dd05458
2 changed files with 4 additions and 9 deletions

View File

@ -82,13 +82,6 @@ class NumericField extends TextField {
return 'numeric text';
}
public function getAttributes() {
return array_merge(parent::getAttributes(), array(
'type' => 'number',
'step' => 'any' // allows entering float/decimal numbers like "1.2" instead of just integers
));
}
/**
* Validate this field
*

View File

@ -187,8 +187,10 @@ class NumericFieldTest extends SapphireTest {
$field = new NumericField('Number');
$html = $field->Field();
$this->assertContains('type="number"', $html, 'number type set');
$this->assertContains('step="any"', $html, 'step value set to any');
// @todo - Revert to number one day when html5 number supports proper localisation
// See https://github.com/silverstripe/silverstripe-framework/pull/4565
$this->assertContains('type="text"', $html, 'number type not set');
}
}