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.
#2

[eluser]donald.tbd[/eluser]
Here i go again. Making a pointless thread without using google proprely! Smile

Turnes out this is actually an "unconfirmed bug", here is a solution http://ellislab.com/forums/viewthread/96617/P15/#689642.
Interesting that after all this time the bug still hasnt been fixed Tongue




Theme © iAndrew 2016 - Forum software by © MyBB