Skip to content

Commit

Permalink
Changed the form style to not affect layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Oct 31, 2010
1 parent a040c9a commit 4eed660
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cake/libs/view/helpers/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ public function button($title, $options = array()) {
* @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));
Expand Down Expand Up @@ -1315,7 +1315,7 @@ public function postLink($title, $url = null, $options = array(), $confirmMessag
}

$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));
Expand Down
12 changes: 9 additions & 3 deletions cake/tests/cases/libs/view/helpers/form.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5162,7 +5162,7 @@ function testButton() {
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',
Expand All @@ -5184,7 +5184,10 @@ public function testPostButton() {
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',
Expand All @@ -5196,7 +5199,10 @@ public function testPostLink() {

$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',
Expand Down

0 comments on commit 4eed660

Please sign in to comment.