From 4eed660a62d922c1f707cdb0cc08a83029ef29a3 Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Sat, 30 Oct 2010 22:39:31 -0200 Subject: [PATCH] Changed the form style to not affect layout. --- cake/libs/view/helpers/form.php | 4 ++-- cake/tests/cases/libs/view/helpers/form.test.php | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 86665b605..aa4a7b146 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -1279,7 +1279,7 @@ class FormHelper extends AppHelper { * @return string A HTML button tag. */ public function postButton($title, $url, $options = array()) { - $out = $this->create(false, array('id' => false, 'url' => $url)); + $out = $this->create(false, array('id' => false, 'url' => $url, 'style' => 'display:none;')); if (isset($options['data']) && is_array($options['data'])) { foreach ($options['data'] as $key => $value) { $out .= $this->hidden($key, array('value' => $value, 'id' => false)); @@ -1315,7 +1315,7 @@ class FormHelper extends AppHelper { } $formName = uniqid('post_'); - $out = $this->create(false, array('url' => $url, 'name' => $formName, 'id' => $formName)); + $out = $this->create(false, array('url' => $url, 'name' => $formName, 'id' => $formName, 'style' => 'display:none;')); if (isset($options['data']) && is_array($options['data'])) { foreach ($options['data'] as $key => $value) { $out .= $this->hidden($key, array('value' => $value, 'id' => false)); diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index 551b1ca84..b1d1f589e 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -5162,7 +5162,7 @@ class FormHelperTest extends CakeTestCase { public function testPostButton() { $result = $this->Form->postButton('Hi', '/controller/action'); $this->assertTags($result, array( - 'form' => array('method' => 'post', 'action' => '/controller/action', 'accept-charset' => 'utf-8'), + 'form' => array('method' => 'post', 'action' => '/controller/action', 'accept-charset' => 'utf-8', 'style' => 'display:none;'), 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), '/div', @@ -5184,7 +5184,10 @@ class FormHelperTest extends CakeTestCase { public function testPostLink() { $result = $this->Form->postLink('Delete', '/posts/delete/1'); $this->assertTags($result, array( - 'form' => array('method' => 'post', 'action' => '/posts/delete/1', 'accept-charset' => 'utf-8', 'name' => 'preg:/post_\w+/', 'id' => 'preg:/post_\w+/'), + 'form' => array( + 'method' => 'post', 'action' => '/posts/delete/1', 'accept-charset' => 'utf-8', + 'name' => 'preg:/post_\w+/', 'id' => 'preg:/post_\w+/', 'style' => 'display:none;' + ), 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), '/div', @@ -5196,7 +5199,10 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->postLink('Delete', '/posts/delete/1', array(), 'Confirm?'); $this->assertTags($result, array( - 'form' => array('method' => 'post', 'action' => '/posts/delete/1', 'accept-charset' => 'utf-8', 'name' => 'preg:/post_\w+/', 'id' => 'preg:/post_\w+/'), + 'form' => array( + 'method' => 'post', 'action' => '/posts/delete/1', 'accept-charset' => 'utf-8', + 'name' => 'preg:/post_\w+/', 'id' => 'preg:/post_\w+/', 'style' => 'display:none;' + ), 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), '/div',