diff --git a/code/model/formfields/EditableNumericField.php b/code/model/formfields/EditableNumericField.php new file mode 100755 index 0000000..1a33fde --- /dev/null +++ b/code/model/formfields/EditableNumericField.php @@ -0,0 +1,33 @@ +getSetting('Rows') && $this->getSetting('Rows') > 1) { + $taf = new NumericField($this->Name, $this->Title); + $taf->setRows($this->getSetting('Rows')); + $taf->addExtraClass('number'); + return $taf; + } + else { + $taf = new NumericField($this->Name, $this->Title, null, $this->getSetting('MaxLength')); + $taf->addExtraClass('number'); + return $taf; + } + } +} diff --git a/code/model/formfields/EditableTextField.php b/code/model/formfields/EditableTextField.php index 5cc2f0f..88a1778 100755 --- a/code/model/formfields/EditableTextField.php +++ b/code/model/formfields/EditableTextField.php @@ -23,10 +23,11 @@ class EditableTextField extends EditableFormField { $extraFields = new FieldList( new FieldGroup(_t('EditableTextField.TEXTLENGTH', 'Text length'), - new TextField($this->getSettingName('MinLength'), "", $min), - new TextField($this->getSettingName('MaxLength'), " - ", $max) + new NumericField($this->getSettingName('MinLength'), "", $min), + new NumericField($this->getSettingName('MaxLength'), " - ", $max) ), - new TextField($this->getSettingName('Rows'), _t('EditableTextField.NUMBERROWS', 'Number of rows'), $rows) + new NumericField($this->getSettingName('Rows'), _t('EditableTextField.NUMBERROWS', + 'Number of rows'), $rows) ); $fields->merge($extraFields); diff --git a/images/editablenumericfield.png b/images/editablenumericfield.png new file mode 100644 index 0000000..088fe24 Binary files /dev/null and b/images/editablenumericfield.png differ diff --git a/lang/en.yml b/lang/en.yml index 2b6d103..ef60267 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -102,6 +102,11 @@ en: PLURALNAME: 'Text Fields' SINGULARNAME: 'Text Field' TEXTLENGTH: 'Text length' + EditableNumericField: + NUMBERROWS: 'Number of rows' + PLURALNAME: 'Number Fields' + SINGULARNAME: 'Number Field' + TEXTLENGTH: 'Number length' EditableUploadField: SELECTUPLOADFOLDER: 'Select upload folder' FieldEditor: