CodeIgniter Forums
Form helper - set ID as well as name? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Form helper - set ID as well as name? (/showthread.php?tid=47055)



Form helper - set ID as well as name? - El Forum - 11-24-2011

[eluser]Unknown[/eluser]
'lo all,
Just about to start using CodeIgniter - have played with examples / tutorials etc. and am liking it - first time I've ever managed to get my head around this sort of programming and I'm enjoying myself.

I do, however, have a question - the form helper can be used to create different types of inputs but the code that is output only specifies the input NAME - <input type="text" name="x" /> - I also want each field to have an ID so it can be referenced by JavaScript, or form labels etc: <input type="text" name="x" id="x" />

I know I can do this using an array of options when I call the helper functions - but ID is so necessary in forms I would prefer to do this automatically if possible.

Can it be done - maybe by modifying the form helper or something?