Hi guys,
I can't understand how to use set_message() form from_validation libraries.
I've read doc, consult stackoverflow and I can't figure it out on how to use it...
What I'm trying to achieve (for now) is checking if a checkbox is cheked or not...
PHP Code:
/*just output the page where user can compile a form*/
public function nuovocosplay()
{
$this->load->view('auth/template/auth_header', $this->pagedata);
$this->load->view('auth/template/auth_nav', $this->cliente);
$this->load->view('auth/clienti/auth_sidebar');
$this->load->view('auth/clienti/nuovocosplay');
$this->load->view('auth/template/auth_footer');
}
This is the part in nuovocosplay.php view that call the checkbox and the error
Code:
<?php echo form_error('accetta_misure', '<div class="error">', '</div>'); ?>
<?php echo form_checkbox('accetta_misure','accetta', FALSE); ?>
PHP Code:
/*this is the validation that call the misure_db model function to write data to DB*/
public function misure_validation() {
$this->load->library('form_validation');
$this->form_validation->set_rules('accetta_misure','accetta','required|md5|trim');
// la funzione run ritorna un true solo se le regole sopra sono verificate
if ($this->form_validation->run() == true) {
$this->misure_db();
} else {
$this->form_validation->set_message('accetta_misure','accetta', 'devi accettare i termini e le condizioni della commissione.');
$this->nuovocosplay(); //ritorna alla schermata delle misure
}
}
I really don't understand what's wrong, I've read that I have to use callbacks? but how...
Thank you in advance and sorry for my noobness