|
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;
}
} |
|