Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/Helpers/form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function form_hidden($name, $value = '', bool $recursing = false): string

if (! is_array($value))
{
$form .= '<input type="hidden" name="' . $name . '" value="' . esc($value) . "\" style=\"display:none;\" />\n";
$form .= form_input($name, $value, '', 'hidden');
}
else
{
Expand Down
12 changes: 6 additions & 6 deletions tests/system/Helpers/FormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ public function testFormOpenWithHidden()
$Name = csrf_token();
$expected = <<<EOH
<form action="http://example.com/index.php/foo/bar" name="form" id="form" method="POST" accept-charset="utf-8">
<input type="hidden" name="foo" value="bar" style="display:none;" />
<input type="hidden" name="$Name" value="$Value" style="display:none;" />
<input type="hidden" name="foo" value="bar" />
<input type="hidden" name="$Name" value="$Value" />

EOH;
}
Expand All @@ -180,7 +180,7 @@ public function testFormOpenWithHidden()
$expected = <<<EOH
<form action="http://example.com/index.php/foo/bar" name="form" id="form" method="POST" accept-charset="utf-8">

<input type="hidden" name="foo" value="bar" style="display:none;" />
<input type="hidden" name="foo" value="bar" />

EOH;
}
Expand Down Expand Up @@ -242,7 +242,7 @@ public function testFormHidden()
{
$expected = <<<EOH

<input type="hidden" name="username" value="johndoe" style="display:none;" />\n
<input type="hidden" name="username" value="johndoe" />\n
EOH;
$this->assertEquals($expected, form_hidden('username', 'johndoe'));
}
Expand All @@ -255,7 +255,7 @@ public function testFormHiddenArrayInput()
];
$expected = <<<EOH

<input type="hidden" name="foo" value="bar" style="display:none;" />
<input type="hidden" name="foo" value="bar" />

EOH;
$this->assertEquals($expected, form_hidden($data, null));
Expand All @@ -269,7 +269,7 @@ public function testFormHiddenArrayValues()
];
$expected = <<<EOH

<input type="hidden" name="name[foo]" value="bar" style="display:none;" />
<input type="hidden" name="name[foo]" value="bar" />

EOH;
$this->assertEquals($expected, form_hidden('name', $data));
Expand Down