Ângelo Rigo Ângelo Rigo - 2 months ago 13x
PHP Question

CakePHP 2.5. Create a hidden form element, error message: undefined offset

I am using CakePHP 2.5 and i try to create a hidden form field, I am getting an error message:

Notice (8): Undefined offset: 1
[ROOT\app\View\Helper\AppHtmlHelper.php, line 23]

I am trying:
Array( $this->Form->input( 'Model.field', Array( 'value' => 0, 'type' => 'hidden') ) )

How can i create a hidden form field using CakePHP 2.5?


This should work:

echo $this->Form->hidden('Model.field', array('value' => '0'));

Docs: http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::hidden