Welcome Guest, Not a member yet? Register   Sign In
Cannot execute MY_Form_validation
#1

[eluser]Adam_R[/eluser]
What is wrong with this:

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

class MY_Form_validation extends CI_Form_validation {

function MY_Form_validation()
{
  parent::CI_Form_validation();
}


function valid_us_date($str)
{
  return ( ! ereg("^[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}$", $str)) ? FALSE : TRUE;
}


function valid_exp_date($str)
{
  return ( ! ereg("^[0-9]{1,2}/[0-9]{4}$", $str)) ? FALSE : TRUE;
}


function valid_phone($str)
{
  return ( ! ereg("^[0-9]{3}-[0-9]{3}-[0-9]{4}$", $str)) ? FALSE : TRUE;
}


function valid_ssn($str)
{
  return ( ! ereg("^[0-9]{3}-[0-9]{2}-[0-9]{4}$", $str)) ? FALSE : TRUE;
}


function valid_zip($str)
{
  return ( ! ereg("^[0-9]{5}$", $str)) ? FALSE : TRUE;
}

}

I'm not able to get any validation from it base on called rules like

Code:
<?php

$config['form_validation'] = array(
    array(
          'field' => 'firstname',
          'label' => 'First Name',
          'rules' => 'trim|required',
          ),
    array(
          'field' => 'lastname',
          'label' => 'Last Name',
          'rules' => 'trim|required',
          ),
    array(
          'field' => 'dob',
          'label' => 'DOB',
          'rules' => 'trim|required|valid_us_date',
          ),
    array(
          'field' => 'recaptcha_response_field',
          'label' => 'Security Question',
          'rules' => 'required|callback_check_captcha',
          )
);


Messages In This Thread
Cannot execute MY_Form_validation - by El Forum - 10-19-2012, 02:23 PM
Cannot execute MY_Form_validation - by El Forum - 10-19-2012, 04:16 PM
Cannot execute MY_Form_validation - by El Forum - 10-19-2012, 05:10 PM
Cannot execute MY_Form_validation - by El Forum - 10-19-2012, 05:13 PM
Cannot execute MY_Form_validation - by El Forum - 10-19-2012, 08:26 PM
Cannot execute MY_Form_validation - by El Forum - 10-19-2012, 11:13 PM
Cannot execute MY_Form_validation - by El Forum - 10-22-2012, 09:27 AM
Cannot execute MY_Form_validation - by El Forum - 10-22-2012, 10:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB