Welcome Guest, Not a member yet? Register   Sign In
An easy solution for setting form input values for combined create/edit forms
#3

[eluser]Moobies[/eluser]
well, there are 2 set_values. there is the helper version and there is the form validation library version. personally, i would like to do this in my controller:

Code:
$this->form_validation->set_value('name', $myobj->name);

and then in my view do:

Code:
<input type=“text” name=“name” value=”<?php echo set_value(‘name’) ?>” />
this is not possible as far as i can tell. you can however do this in your controller

Code:
$this->load->view('theformview', array('myobj' => $myobj);

and then in the view

Code:
<input type=“text” name=“name” value=”<?php echo set_value(‘name’, $myobj->name) ?>” >

however i find the former neater.

and in fact, you can just put my put_value in a MY_Form_validation class to keep it out of the core.

i am new to CI so you may have a better solution to that which i present Smile


Messages In This Thread
An easy solution for setting form input values for combined create/edit forms - by El Forum - 04-30-2009, 07:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB