[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(); ?>