mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Changed the form style to not affect layout.
This commit is contained in:
parent
a040c9a218
commit
4eed660a62
2 changed files with 11 additions and 5 deletions
|
@ -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));
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue