CodeIgniter Forums
Form Helper adding class to the text box - 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 adding class to the text box (/showthread.php?tid=39919)



Form Helper adding class to the text box - El Forum - 03-24-2011

[eluser]R_Nelson[/eluser]
with the form helper is there a way to send a class into form_text() or can someone show me how to extend the helper to allow it?
when i do a view source i would like to see this
Code:
<input type="text" id="username" name="username" class="inn"/>



Form Helper adding class to the text box - El Forum - 03-24-2011

[eluser]Madmartigan1[/eluser]
There is no function form_text()

Just do this: form_input('my_name', 'my_value', 'class="inn"');

You can also pass an associative array to the first param. Maybe the third too/instead, not sure.

It's clearly documented in the user guide. You should have received a copy with your CI download. If not, it's online here:

http://ellislab.com/codeigniter/user-guide/


Form Helper adding class to the text box - El Forum - 03-24-2011

[eluser]R_Nelson[/eluser]
my bad was in a hurry when i wrote it lol i must have missed it in the guide!


Form Helper adding class to the text box - El Forum - 03-24-2011

[eluser]InsiteFX[/eluser]
R_Nelson, You can create a MY_form_helper and make all the changes you need in it!

InsiteFX


Form Helper adding class to the text box - El Forum - 03-24-2011

[eluser]R_Nelson[/eluser]
thanks for all the help i ended up using a helper file of my own and it works great!