Welcome Guest, Not a member yet? Register   Sign In
[SLOVED] Controller Showing Two Callback Validation Messages.
#1

[eluser]riwakawd[/eluser]
When my call back is in effect it shows up two errors on my login form I am only wanting my custom error to show up.

How do I stop the second error message from showing up. Here is a sample image of my errors that are showing up. Error Message Sample Image


Second Error Message: Unable to access an error message corresponding to your field name.

I use hmvc also with my callbacks.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends Controller {
      
   private $error = array();
      
   public function __construct() {
      parent::__construct();
      $this->load->library('user');
      $this->load->library('form_validation');
      $this->lang->load('common/login', 'english');
      if($this->session->userdata('user_id')) {
         redirect('dashboard');
      } else {
         return false;
         redirect('login');
      }
   }

   public function index() {
      $this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[12]|xss_clean|callback_validate');
      $this->form_validation->set_rules('password', 'Password', 'required|xss_clean');

      if($this->form_validation->run($this) == false) {
        
         if (array_key_exists('warning', $this->error)) {
            $data['error_warning'] = $this->error['warning'];
         } else {
            $data['error_warning'] = '';
         }

         $data['action'] = site_url('login');

         $this->load->view('common/login.tpl', $data);
      } else {
          redirect('dashboard');
      }
   }

   public function validate() {
      $username = $this->input->post('username');
      $password = $this->input->post('password');

      if ($this->user->login($username, $password)) {
          return true;
      } else {
         $this->error['warning'] = $this->lang->line('error_login');
         return !$this->error;
      }
   }
}


Messages In This Thread
[SLOVED] Controller Showing Two Callback Validation Messages. - by El Forum - 06-29-2014, 04:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB