Setting a default value for a form with form validation library - 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: Setting a default value for a form with form validation library (/showthread.php?tid=20284) |
Setting a default value for a form with form validation library - El Forum - 07-04-2009 [eluser]steven2[/eluser] Is there a way to set a default value when a form is first loaded with the Form Validation library? Here it the function page in my controller, I load the validation library in my constructor. Code: function join() and here is the relevant part of the view Code: echo form_open('welcome/join', $attributes); This seems to work correctly setting the default value to 'tester default', but since it wasn't mentioned in the user guide I wonder if there is an easier way to do it, or if this is a bad idea. I found this page http://www.sellersrank.com/codeigniter/using-the-code-igniter-validation-class-to-set-default-form-values/ which seems to describe how to do add to the existing validation class, but I would strongly prefer not to go that route. Setting a default value for a form with form validation library - El Forum - 07-04-2009 [eluser]TheFuzzy0ne[/eluser] Yes, see set_value() in the [url="http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html"]form helper[/url]. |