[eluser]Bogdan Tanase[/eluser]
Hi guys,
I'm trying to write a form using the new validation library, and I'm a little confused on how I should implement an "edit" feature. I use the same view for add and edit and two functions in my controller: add and edit.
In the old library in the edit function I was using the following code to autocomplete edited fields when edit function was first called:
Code:
// the validation rules and fields are already set
// now we need to retrieve the existing data from DB
$current_item=$this->my_table->get_one($item_id); // a model function that returns current item
// details
$this->validation->name=$current_item->name;
$this->validation->age= $current_item->age;
// ... do rest of stuff
in my view I had something like this:
Code:
<?=form_input('name', $this->validation->name)?>
<?=form_input('age', $this->validation->age)?>
<!-- ... -->
now, I understand that, with the new library, in the view I set the values using set_value, but how do I set them in the controller, to be used then by the set_value function?
Thanks,
Bogdan