CodeIgniter Forums
form_hidden() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: form_hidden() (/showthread.php?tid=17412)



form_hidden() - El Forum - 04-03-2009

[eluser]halwaraj[/eluser]
Hi,

I am using the following Function:
Code:
form_hidden()
.

The problem is, the above statement is producing multiple tags.

If I do the following in the view file:

Code:
$hidden = array(
                'name'      => 'hiddenStory',
                'id'        => 'hiddenStory',
                'value'     => '',
            );


            echo form_hidden( $hidden );

It generates the following
Code:
<input name="name" value="hiddenLund" type="hidden">
<input name="id" value="hiddenLund" type="hidden">
<input name="value" value="" type="hidden">

What might be wrong?


Also, when I comment out the "echo form_hidden( $hidden );"

None of the above 3 tags are created


form_hidden() - El Forum - 04-04-2009

[eluser]cahva[/eluser]
It does what it supposed to be. If you have an array, it will create multiple hidden fields. So do just:
Code:
echo form_hidden('hiddenStory','');

form_hidden function does not support extra properties so you cannot give it id. If youre planning to populate it with javascript, you can use getElementByName instead of getElementById.


form_hidden() - El Forum - 04-04-2009

[eluser]halwaraj[/eluser]
oh is it? / / /

What happens in the case of form_input?


form_hidden() - El Forum - 04-04-2009

[eluser]cahva[/eluser]
RTFM Smile Really, the userguide is quite clear.


form_hidden() - El Forum - 04-04-2009

[eluser]halwaraj[/eluser]
oh right. Thanks alot.