Welcome Guest, Not a member yet? Register   Sign In
Re-populating form and hack
#7

[eluser]dhenoer[/eluser]
Oh, I see now. You are right and thank you..
I'v tested, that we do not need if ($this->input->post('submit')) to detect if the submitted data are coming.. Hmm.. In my mind before, we have to protect validation process only to be done when submitted exist..

Ok, but my question have still unsolved yet. I revised the code..
Code:
function edit($id){
  
        $this->form_validation->set_rules('ID','Identity','required');
        $this->form_validation->set_rules('Name','Name','required|min_length[5]');

        if ($this->form_validation->run()){
            $d['propID'] = $this->input->post('ID');
            $d['propName'] = $this->input->post('Name');
            $this->testmodel->update($d, $id);
            //success!;
            redirect('to_another_page');
        }

        //$data????
        $this->load->view('test/edit', $data);
}

The question is, how to get $data? $data is needed to become initial value of my form.
If $data is gotten from database, they will show again when the validation runs fail. The form would be repopulated from database again, NOT the last input by users...


Messages In This Thread
Re-populating form and hack - by El Forum - 12-10-2009, 03:30 AM
Re-populating form and hack - by El Forum - 12-10-2009, 04:57 AM
Re-populating form and hack - by El Forum - 12-10-2009, 07:28 AM
Re-populating form and hack - by El Forum - 12-10-2009, 07:38 AM
Re-populating form and hack - by El Forum - 12-10-2009, 06:27 PM
Re-populating form and hack - by El Forum - 12-11-2009, 01:12 AM
Re-populating form and hack - by El Forum - 12-11-2009, 04:10 AM
Re-populating form and hack - by El Forum - 12-11-2009, 04:16 AM
Re-populating form and hack - by El Forum - 12-11-2009, 04:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB