diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 7b6dd35a5..84bc7a2e2 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -363,10 +363,6 @@ class FormHelper extends AppHelper { unset($options['label']); } $submitOptions = $options; - - if (!$submit) { - $submit = __('Submit', true); - } } $out .= $this->submit($submit, $submitOptions); } @@ -1309,7 +1305,7 @@ class FormHelper extends AppHelper { * @link http://book.cakephp.org/view/1431/submit */ function submit($caption = null, $options = array()) { - if (!$caption) { + if (!is_string($caption) && empty($caption)) { $caption = __('Submit', true); } $out = null; diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index 3aea5e665..8816fe816 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -5284,6 +5284,14 @@ class FormHelperTest extends CakeTestCase { * @return void */ function testSubmitButton() { + $result = $this->Form->submit(''); + $expected = array( + 'div' => array('class' => 'submit'), + 'input' => array('type' => 'submit', 'value' => ''), + '/div' + ); + $this->assertTags($result, $expected); + $result = $this->Form->submit('Test Submit'); $expected = array( 'div' => array('class' => 'submit'), @@ -6333,6 +6341,24 @@ class FormHelperTest extends CakeTestCase { function testFormEnd() { $this->assertEqual($this->Form->end(), ''); + $result = $this->Form->end(''); + $expected = array( + 'div' => array('class' => 'submit'), + 'input' => array('type' => 'submit', 'value' => ''), + '/div', + '/form' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->end(array('label' => '')); + $expected = array( + 'div' => array('class' => 'submit'), + 'input' => array('type' => 'submit', 'value' => ''), + '/div', + '/form' + ); + $this->assertTags($result, $expected); + $result = $this->Form->end('save'); $expected = array( 'div' => array('class' => 'submit'),