![]() |
Form Helper Label - 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 Label (/showthread.php?tid=49012) |
Form Helper Label - El Forum - 02-05-2012 [eluser]Perkin5[/eluser] I want to give a label the class of 'required' so I can do: Code: $data = array( but for a single attribute, it doesn't seem worth using an array. So I tried: Code: echo form_label('First Name','','class="required"'); but it doesn't work. A simlar approach works with other form helper elements so why doesn't this work? Or how can it be made to work? Form Helper Label - El Forum - 02-05-2012 [eluser]CroNiX[/eluser] Extend the form_helper with your own form_label() function. Looking at the code, it seems pretty easy to do what you are wanting there. Form Helper Label - El Forum - 02-05-2012 [eluser]Perkin5[/eluser] Gulp! That would be a first for me... Form Helper Label - El Forum - 02-05-2012 [eluser]CroNiX[/eluser] Read the Extending Helpers section. It's pretty easy (as is extending just about everything in CI). Form Helper Label - El Forum - 02-05-2012 [eluser]Perkin5[/eluser] OK - thanks Form Helper Label - El Forum - 02-05-2012 [eluser]InsiteFX[/eluser] Just p[ass it the css class name in $str Saveas: ./application/helpers/MY_form_helper.php Code: // ------------------------------------------------------------------------ |