diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index a30cc919f..f72ea120d 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -1608,8 +1608,10 @@ class FormHelperTest extends CakeTestCase { 'unlockedFields' => array() ); - $this->Form->create('Contact'); $this->Form->unlockField('Contact.id'); + $this->Form->create('Contact'); + $this->Form->hidden('Contact.id', array('value' => 1)); + $this->assertEmpty($this->Form->fields, 'Field should be unlocked'); $this->Form->end(); $this->Form->create('Contact'); diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 31b18010f..2282a38e5 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -467,7 +467,6 @@ class FormHelper extends AppHelper { $htmlAttributes = array_merge($options, $htmlAttributes); $this->fields = array(); - $this->_unlockedFields = array(); if ($this->requestType !== 'get') { $append .= $this->_csrfField(); } @@ -561,6 +560,7 @@ class FormHelper extends AppHelper { $this->setEntity(null); $out .= $this->Html->useTag('formend'); + $this->_unlockedFields = array(); $this->_View->modelScope = false; $this->requestType = null; return $out;