Welcome Guest, Not a member yet? Register   Sign In
Newbie question....FreakAuth modifying
#1

[eluser]mgandha[/eluser]
Im trying to show error validation messages. I swear i followed all the steps here is my code is below, there is no errors, company_check custom validator is fine code is going into the if loop when company_id = 0. However '$this->fal_validation->{'company_id'.'_error'} ' this code is just not showing the error msg.. any suggestiions??? The FAL example works fine the only difference is how it calls the view like this: return $this->CI->load->view($this->CI->config->item('FAL_register_view'), $data, TRUE);



view
Code:
<?=(isset($this->fal_validation) ? $this->fal_validation->{'company_id'.'_error'} : '')?>

controller
Code:
$fields['company_id'] = $this->lang->line('FAL_user_company_label');

            $rules['company_id'] = $this->config->item('FAL_user_company_field_validation_register');    

      

        //-----------------------------------------------

        //ADD MORE FIELDS AND RULES HERE IF YOU NEED THEM

        //-----------------------------------------------

        

        $this->CI->fal_validation->set_fields($fields);

        $this->CI->fal_validation->set_rules($rules);
//if everything went ok

        if ($this->CI->fal_validation->run() == TRUE)

        {
        log_message('info','everything went ok');
        $data['page'] = $this->config->item('FAL_template_dir').'template/accounting/index';

        $this->load->vars($data);

        $this->load->view($this->_container);

        }

      

        //redisplay the register form

        else

        {    

                $data['companys'] = $this->company_model->getCompanysForSelect();

            

            //displays the view

          $data['heading'] = 'Accounting - Add Transaction';
           $data['page'] = $this->config->item('FAL_template_dir').'template/accounting/addtrans.php';

            
        $this->load->vars($data);

            return $this->load->view($this->_container);

library:
Code:
function company_check($company_id)
    {
            if ($company_id == 0)
            {
            log_message('info','company id = '.$company_id);
                //$this->validation->country_id= $country_id;
                    $this->set_message('company_check', $this->CI->lang->line('FAL_company_validation_message'));
                return FALSE;
            }

        return true;
    }
#2

[eluser]mgandha[/eluser]
Found out its this that does not work:

$this->CI->lang->line('FAL_company_validation_message')

im 100% sure i placed the coresponding line in the config file.. do i need to restart apache or something?
#3

[eluser]mgandha[/eluser]
Ok found the problem needed to add lang->load('xxxx') in the controller itself.. I thought it would return an error if a lang file should not be found...




Theme © iAndrew 2016 - Forum software by © MyBB