Welcome Guest, Not a member yet? Register   Sign In
new validation library autocomplete field
#1

[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


Messages In This Thread
new validation library autocomplete field - by El Forum - 10-28-2008, 11:02 AM
new validation library autocomplete field - by El Forum - 10-28-2008, 11:20 AM
new validation library autocomplete field - by El Forum - 10-31-2008, 02:14 PM
new validation library autocomplete field - by El Forum - 10-31-2008, 02:35 PM
new validation library autocomplete field - by El Forum - 10-31-2008, 03:08 PM
new validation library autocomplete field - by El Forum - 12-06-2008, 07:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB