Welcome Guest, Not a member yet? Register   Sign In
Repopulating form after validation with set_value()?
#1

[eluser]donald.tbd[/eluser]
Hello,

I have run into a problem while repopulating a form after validation.

Here is my view file:
Code:
<?=form_open('notebook/add');?>
<?=form_input("title", set_value("title"))?>
<?=form_textarea("content", set_value("content"))?>
<?=form_submit('submit', 'OK')
<?=form_close();?>

Here is my controller:
Code:
function add(){
  if($this->input->post("submit")){
    $this->load->library('form_validation');
    $this->form_validation->set_rules('title', 'Title', 'required|min_length[4]');
    if($this->form_validation->run()){
                      
    }else{
      $this->template->load("frame", "notebook/add");
    }
  } else {
    $this->template->load("frame", "notebook/add");
  }
}

Now the problem is that the textarea (content) field isnt being repopulated.
If i do a var_dump($_POST) in the beginning of my view file then both title and content exist but if i do a var_dump(set_value("content")) then nothing is there.

Any thought on that? Thanks.


Messages In This Thread
Repopulating form after validation with set_value()? - by El Forum - 06-08-2011, 05:24 PM
Repopulating form after validation with set_value()? - by El Forum - 06-08-2011, 05:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB