Welcome Guest, Not a member yet? Register   Sign In
Mixing controller form processing and form displaying ?
#2

[eluser]oppenheimer[/eluser]
There is one controller in the example shown in the user's guide for validation:

<a href="http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html">http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html</a>

The validation check will be FALSE for two conditions:
1 - the first time through so the form can be displayed
2 - when the user submits a form with errors.

You will need a second check to determine which of these conditions exist.

Code:
if ($this->form_validation->run() == FALSE)
    if ($this->input->post('submit'))
    {
         [DISPLAY ERROR]
    }
else
    {
         $this->load->view('myform');
    }

Although why wouldn't you want to redisplay the form with the error and repopulate the form with the submitted data as shown in the example in the user's guide?


Messages In This Thread
Mixing controller form processing and form displaying ? - by El Forum - 04-25-2011, 11:10 AM
Mixing controller form processing and form displaying ? - by El Forum - 04-25-2011, 01:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB