From f737d52138b9bd4b9cb003a46f19b8df3f040d19 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 6 Apr 2008 04:02:05 +0000 Subject: [PATCH] Merged revisions 47500 via svnmerge from svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r47500 | ischommer | 2007-12-22 17:25:34 +1300 (Sat, 22 Dec 2007) | 1 line changed field-rendering to use createTag() ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52188 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TextField.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/forms/TextField.php b/forms/TextField.php index cf5964ef4..889ad4d3f 100755 --- a/forms/TextField.php +++ b/forms/TextField.php @@ -22,15 +22,18 @@ class TextField extends FormField { } function Field() { - $extraClass = $this->extraClass(); + $attributes = array( + 'type' => 'text', + 'class' => $this->extraClass() . " maxlength", + 'id' => $this->id(), + 'name' => $this->attrName(), + 'value' => $this->attrValue(), + 'tabindex' => $this->getTabIndexHTML(), + 'maxlength' => ($this->maxLength) ? $this->maxLength : null, + 'size' => ($this->maxLength) ? min( $this->maxLength, 30 ) : 30 + ); - $fieldSize = $this->maxLength ? min( $this->maxLength, 30 ) : 30; - - if($this->maxLength) { - return "id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"$this->maxLength\" size=\"$fieldSize\" />"; - } else { - return "id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" />"; - } + return $this->createTag('input', $attributes); } function InternallyLabelledField() {