From bb5eff8bed22b8cfaf23536f6b8ac8d5d3c5fbe3 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 22 May 2009 10:18:15 +0000 Subject: [PATCH] BUGFIX Ensure that any white space is stripped in FieldSet::dataFieldByName() and FieldSet::fieldByName() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77650 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/FieldSet.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forms/FieldSet.php b/forms/FieldSet.php index ca67c99ad..45cbe07c9 100755 --- a/forms/FieldSet.php +++ b/forms/FieldSet.php @@ -288,7 +288,7 @@ class FieldSet extends DataObjectSet { else $remainder = null; foreach($this->items as $child) { - if($name == $child->Name() || $name == $child->id) { + if(trim($name) == trim($child->Name()) || $name == $child->id) { if($remainder) { if($child->isComposite()) { return $child->fieldByName($remainder); @@ -313,7 +313,7 @@ class FieldSet extends DataObjectSet { public function dataFieldByName($name) { if($dataFields = $this->dataFields()) { foreach($dataFields as $child) { - if($name == $child->Name() || $name == $child->id) return $child; + if(trim($name) == trim($child->Name()) || $name == $child->id) return $child; } } }