diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 7193c219d..2e4f4f752 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -1013,7 +1013,7 @@ class FormHelper extends AppHelper { $div = $options['div']; unset($options['div']); } - $divOptions = array(); + $divOptions = array('tag' => 'div'); if ($div === true) { $divOptions['class'] = 'submit'; @@ -1022,7 +1022,7 @@ class FormHelper extends AppHelper { } elseif (is_string($div)) { $divOptions['class'] = $div; } elseif (is_array($div)) { - $divOptions = array_merge(array('class' => 'submit'), $div); + $divOptions = array_merge(array('class' => 'submit', 'tag' => 'div'), $div); } $out = $secured; @@ -1042,7 +1042,9 @@ class FormHelper extends AppHelper { } if (isset($divOptions)) { - $out = $this->Html->div($divOptions['class'], $out, $divOptions); + $tag = $divOptions['tag']; + unset($divOptions['tag']); + $out = $this->Html->tag($tag, $out, $divOptions); } return $out; } diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index fa85059a6..78f2b843f 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -2910,6 +2910,14 @@ class FormHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); + $result = $this->Form->submit('Test Submit', array('div' => array('tag' => 'span'))); + $expected = array( + 'span' => array('class' => 'submit'), + 'input' => array('type' => 'submit', 'value' => 'Test Submit'), + '/span' + ); + $this->assertTags($result, $expected); + $result = $this->Form->submit('Test Submit', array('class' => 'save', 'div' => false)); $expected = array('input' => array('type' => 'submit', 'value' => 'Test Submit', 'class' => 'save')); $this->assertTags($result, $expected);