[eluser]RaGe10940[/eluser]
Hello,
I am trying to create my own validation rules however the rules that I am creating are being violated and no message is showing on the screen. Can some one help?
My extended library :
Code:
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class MY_Form_Validation extends CI_Form_Validation
{
function __construct()
{
parent::CI_Form_Validation();
}
public function alpha_dash_space($str)
{
if (!preg_match("/^([-a-z0-9_ ])+$/i", $str))
{
$this -> form_validation -> set_message('alpha_dash_space', 'The %s field can only contain letters, spaces, and underscores allowed');
return FALSE;
}
}
the rule sets in my config file called form_validation.php
Quote:'c_scholarshipmaintance/addnewscholarship' => array(
array(
'field' => 'scholname',
'label' => 'Scholarship Name',
'rules' => 'required|alpha_dash_space|max_length[150]'
),
Code:
echo form_input('scholname', set_value('scholname'), 'placeholder="Scholarship Name", autocomplete="off"');
and this is how I call it :
Code:
if ($this -> form_validation -> run('c_scholarshipmaintance/addnewscholarship'))// If no validation errors
{
//.........
}
any help would be helpful