发新话题
打印

发现个问题,ci验证类callback函数里不能判断空值

发现个问题,ci验证类callback函数里不能判断空值

function catadd(){
        $this->load->helper('form');
        $this->load->library('validation');
        $rules['catsel'] = "callback_catsel_check";
        $rules['parentcatsel'] = "required";
        $rules['name'] = "required|callback_name_check";
        $this->validation->set_rules($rules);
        if($this->validation->run() == false){
            $this->load->view("admincp/cat/cat_add.php");
        }else{
            $this->load->view("admincp/cat/success.php");
        }



function name_check($str){
       if ($str == ''){
            $this->validation->set_message('name_check',"<script>alert('分类名称不能为空!');</script>");
            return false;
       }else{
           return true;
       }
   }

TOP

什么东东?能不能稍微讲解一下?呵呵~
QQ: 49489680
MSN: zhaochang_tj AT hotmail DOT com

TOP

验证类本身不是就能判断是否为空的么?为何要用自定义的callback来验证这个?
Fred Wu
thislab.com

TOP

我也刚发现这个问题

好像callback函数根本就没有调用

高手帮忙啊!

TOP

required

TOP

都是自己写验证
CodeIgniter,JQuery,Ext
http://www.girlsgroup.cn

TOP

发新话题