Welcome Guest, Not a member yet? Register   Sign In
Having some trouble with form validation
#1

[eluser]baalwww[/eluser]
Hi. I'm having some trouble with form validation. The docs show the validation example with a form that is displayed immediately. In my case, I'm returning the form in a variable, and then passing it as content to be displayed in the center section of a formatted page...

Code:
function login()
      {
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        
        $this->form_validation->set_rules('email','Email','required|valid_email|trim|xss_clean');
        $this->form_validation->set_rules('password','Password','required|trim|xss_clean');
        
        if ($this->form_validation->run() == FALSE)
        {
            $data['content']=$this->load->view('admin_login','',true);
        }
        else
        {
        }
            $this->load->view('frame',$data);

The else is empty because whether the login form should be shown or the login is successful, the formatted page is shown, so there's nothing needed in the else clause.

The problem is that the validation messages don't show. If the form doesnt validate, I just get the form again with no messages.


Messages In This Thread
Having some trouble with form validation - by El Forum - 11-28-2008, 10:40 PM
Having some trouble with form validation - by El Forum - 11-29-2008, 06:19 AM
Having some trouble with form validation - by El Forum - 11-29-2008, 12:37 PM
Having some trouble with form validation - by El Forum - 11-29-2008, 10:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB