![]() |
Pre-populated form with validation class - 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: Pre-populated form with validation class (/showthread.php?tid=7224) |
Pre-populated form with validation class - El Forum - 03-30-2008 [eluser]Unknown[/eluser] Hi, I have an "edit" page for a form and am using the validation class, but can't figure out how to display the initial value retrieved from the database. If I have to assign the value of the validation to the input, what's a good way to pre-populate the field with the initial value? view: Code: echo form_input('name', $this->validation->name); controller: Code: public function edit() { Pre-populated form with validation class - El Forum - 03-30-2008 [eluser]Unknown[/eluser] Well, I got it to work using the following in my else code block: Code: $data['query'] = $this->Company_model->get_single($id); Although, if there's a better way or if there might problems with this way, I'd love to hear. Thanks! Pre-populated form with validation class - El Forum - 03-31-2008 [eluser]Merolen[/eluser] From another post I got this tips. I've set up each input field as an array Code: $inputField = array( This goes for both input fields and select boxes. Checkboxes and radiobuttons I haven't quite figured out yet Pre-populated form with validation class - El Forum - 03-31-2008 [eluser]Skuja[/eluser] look in here And comon man, try use the search feature of this forum. This problem has been discused lots of times. |