Welcome Guest, Not a member yet? Register   Sign In
Validation problem - Config | Callback | Controller
#14

[eluser]Multisnet[/eluser]
libraries/MO_Form_validation.php

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

class MO_Form_Validation extends CI_Form_Validation {

    function MO_Form_Validation()
    {
        parent::CI_Form_Validation();
        echo "LOAD - >MO_Form_Validation";
    }
}

?>

controller/registo_p_ctr.php

Code:
function validacaoRegisto(){
        $this->load->library('form_validation');
        if ($this->form_validation->run('registoPaciente') == FALSE)
        {
            $this->template->write_view('reg_conteudos_centro', 'paciente_form_registo');
            $this->template->render();
        }
        else
        {
            echo("SUCESS!!!!!!!!!!!!!");
        }
    }


config/form_validation.php
Code:
$config = array(
            'registoPaciente'=>array(
                   array(
                         'field'   => 'nome',
                         'label'   => 'Nome',
                         'rules'   => 'required|alpha'
                      ),
                   array(
                         'field'   => 'apelido',
                         'label'   => 'Apelido',
                         'rules'   => 'required|alpha'
                      ),
                   array(
                         'field'   => 'email',
                         'label'   => 'Email',
                         'rules'   => 'required|callback_verificaEmail'
                      )
                  
                   (...)
)

And a view with the form and
Code:
<?php echo validation_errors(); ?>


Messages In This Thread
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 08:42 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 08:54 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 08:55 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 08:57 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 09:01 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 09:11 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 09:45 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 09:54 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:04 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:05 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:21 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:22 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 10:24 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 11:58 AM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 12:56 PM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 01:23 PM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 01:29 PM
Validation problem - Config | Callback | Controller - by El Forum - 06-24-2009, 03:02 PM
Validation problem - Config | Callback | Controller - by El Forum - 06-25-2009, 06:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB