From 86c344917d88c1f548eee3ec66cd07ae0fd7b435 Mon Sep 17 00:00:00 2001 From: gwoo Date: Thu, 11 Jan 2007 00:11:55 +0000 Subject: [PATCH] updating FormHelper, #1860 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4282 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helpers/form.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index ba15a1297..c691760cc 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -354,8 +354,12 @@ class FormHelper extends AppHelper { if(isset($options['rows']) || isset($options['cols'])) { $options['type'] = 'textarea'; } - $empty = (isset($options['empty']) ? $options['empty'] : ''); - unset($options['empty']); + + $empty = false; + if(isset($options['empty'])) { + $empty = $options['empty']; + unset($options['empty']); + } $type = $options['type']; unset($options['type']); @@ -378,18 +382,21 @@ class FormHelper extends AppHelper { $out .= $this->Html->file($tagName); break; case 'select': - $list = (isset($options['options']) ? $options['options'] : array()); - unset($options['options'], $options['empty']); + $list = array(); + if(isset($options['options'])) { + $list = $options['options']; + unset($options['options']); + } $out .= $this->select($tagName, $list, $selected, $options, $empty); break; case 'time': - $out .= $this->dateTimeOptionTag($tagName, null, '12', $selected, $options, null, false); + $out .= $this->Html->dateTimeOptionTag($tagName, null, '12', $selected, $options, null, $empty); break; case 'date': - $out .= $this->Html->dateTimeOptionTag($tagName, 'MDY', null, $selected, $options, null, false); + $out .= $this->Html->dateTimeOptionTag($tagName, 'MDY', null, $selected, $options, null, $empty); break; case 'datetime': - $out .= $this->Html->dateTimeOptionTag($tagName, 'MDY', '12', $selected, $options, null, false); + $out .= $this->Html->dateTimeOptionTag($tagName, 'MDY', '12', $selected, $options, null, $empty); break; case 'textarea': default: