Welcome Guest, Not a member yet? Register   Sign In
form validation - error
#1

[eluser]penta997[/eluser]
hi. I have a problem with a form. When I fill register form, and submit it i have an error:
Fatal error: Call to a member function set_rules() on a non-object in...

this is my validation function
Code:
function validate()
       {
      
             $widok['left'] = $this->get_category();
            $widok['right'] = $this->load->view('Ksiegarnia/right', '', true);

          

           $this->form_validation->set_rules('username', 'User Name', 'trim|required|min_length[4]');
           $this->form_validation->set_rules('pass', 'Password', 'trim|required|min_length[4]|max_length[32]');
           $this->form_validation->set_rules('pass2', 'Password Confirmation', 'trim|required|matches[pass]');
           $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
           $this->form_validation->set_rules('pesel', 'Pesel', 'trim|required|max_length[11]');
           $this->form_validation->set_rules('regon', 'Regon', 'trim|required|max_length[11]');
           $this->form_validation->set_rules('nip', 'Nip', 'trim|required|max_length[11]');
           $this->form_validation->set_rules('telefon', 'Telefon', 'trim|required|max_length[11]');
           $this->form_validation->set_rules('ulica', 'Ulica', 'trim|required|');
           $this->form_validation->set_rules('nr_ulicy', 'Nr ulicy', 'trim|required|max_length[11]');
           $this->form_validation->set_rules('nr_domu', 'Nr domu', 'trim|required|max_length');
           $this->form_validation->set_rules('kod_pocztowy', 'Kod pocztowy', 'trim|required|max_length[11]');
           $this->form_validation->set_rules('fax', 'Fax', 'trim|required|max_length');



           if($this->form_validation->run() == FALSE)
           {
               $this->register();
           }

           else
           {
                $this->load->model('Users_model');
                $query = $this->Users_model->create_User();

                if($query)
                {
                    $data = 'rejestracja powiodla sie';
                     $widok['center'] = $this->load->view('Ksiegarnia/register_view', $data, true);

                    $this->load->view('Ksiegarnia/index', $widok);
                }

                else
                {
                    $data = 'rejestracja nie powiodla sie';
                     $widok['center'] = $this->load->view('Ksiegarnia/register_view', $data, true);

                    $this->load->view('Ksiegarnia/index', $widok);
                }
           }
       }
#2

[eluser]cideveloper[/eluser]
Where are you loading the form validation class?

Code:
$this->load->library('form_validation');
#3

[eluser]penta997[/eluser]
In autoload.php file.
$autoload['libraries'] = array('database', 'validation','table','calendar', 'session');
#4

[eluser]lennierb5[/eluser]
[quote author="penta997" date="1295163821"]In autoload.php file.
$autoload['libraries'] = array('database', 'validation','table','calendar', 'session');[/quote]

Change 'validation' to 'form_validation'
#5

[eluser]penta997[/eluser]
now I have another error: Unable to load the requested language file: language/polish/form_validation_lang.php
#6

[eluser]lennierb5[/eluser]
Do you have your

Code:
$config['language'];
Set to = "polish"?

If so codeigniter is looking for similar files found in system/language/english in order to display the correct errors.

There are some other language packs you can look at here:

http://codeigniter.com/wiki/Language_Translation/

There is one for polish but it is 1.7.2.
#7

[eluser]penta997[/eluser]
I have downloaded polish languange pack and it works.




Theme © iAndrew 2016 - Forum software by © MyBB