diff --git a/src/View/Helper/FormHelper.php b/src/View/Helper/FormHelper.php index df20e84dd5b..c7a18946e82 100644 --- a/src/View/Helper/FormHelper.php +++ b/src/View/Helper/FormHelper.php @@ -1596,7 +1596,7 @@ public function hidden($fieldName, $options = array()) { )); if ($secure === true) { - $this->_secure(true, null, '' . $options['value']); + $this->_secure(true, null, '' . $options['val']); } $options['type'] = 'hidden'; diff --git a/tests/TestCase/View/Helper/FormHelperTest.php b/tests/TestCase/View/Helper/FormHelperTest.php index 4146b44fcb4..9a33d2f0ef6 100644 --- a/tests/TestCase/View/Helper/FormHelperTest.php +++ b/tests/TestCase/View/Helper/FormHelperTest.php @@ -7829,12 +7829,14 @@ public function testTextAreaWithStupidCharacters() { * @return void */ public function testHiddenField() { - $this->markTestIncomplete('Need to revisit once models work again.'); - $Contact->validationErrors['field'] = 1; - $this->Form->request->data['Contact']['field'] = 'test'; - $result = $this->Form->hidden('Contact.field', array('id' => 'theID')); + $this->article['errors'] = [ + 'field' => true + ]; + $this->Form->request->data['field'] = 'test'; + $this->Form->create($this->article); + $result = $this->Form->hidden('field', array('id' => 'theID')); $this->assertTags($result, array( - 'input' => array('type' => 'hidden', 'class' => 'form-error', 'name' => 'Contact[field]', 'id' => 'theID', 'value' => 'test')) + 'input' => array('type' => 'hidden', 'class' => 'form-error', 'name' => 'field', 'id' => 'theID', 'value' => 'test')) ); }