function no_selected(){
var parentid=$('#parentid');
var parentid_selectValue=parentid.val();
var currSelectIndex=$('#current_parentid').val();
var url="__URL__/no_selected";
var pars='/current_id/'+ currSelectIndex +'/source_id/'+ parentid_selectValue +'/temp/'+Math.random()+'/';
$(document).ready(function(){
$.formValidator.initConfig({formid:"Form1",onerror:function(msg){alert(msg)},onsuccess:function(){return false;}});
$("#current_parentid").formValidator({tipid:"result",onshow:"请选择目标分类!",onfocus:"目标分类不能为空!",oncorrect:"谢谢你的合作"})
.inputValidator({min:1,onerror:"目标分类不能为空!"})
.ajaxValidator({
type : "POST",
url : "__URL__/no_selected"+pars,
datatype : "html",
success : function(data){
if( data == "1" )
{
return true;
}
else
{
alert(data);
$("#result").html(data);
return false;
}
},
buttons: $("#Submit"),
error: function(){alert("服务器没有返回数据,可能服务器忙,请重试");},
onerror :'验证失败!',
onwait : "正在对用户名进行合法性校验,请稍候..."
})
});
}function no_selected(){//非正常选取
$cata= D($this->cata_table);
$current_id=$_GET["current_id"];
$source_id=$_GET["source_id"];
if (!$source_id){
// $this->ajaxReturn('','源分类不能为空!',0);
echo '源分类不能为空!';exit;
} if (!$current_id){
//$this->ajaxReturn('','目标分类不能为空!',0);
echo '目标分类不能为空!';exit;
} if ($current_id==$source_id){
$err="<font color=\"red\">对不起,源分类不能与目标分类相同!</font>";
// $this->ajaxReturn('',$err,0);
echo $err;exit;
} $osql="select roue_id,parentid from ". $this->table_name . " where news_catas_id=$source_id";
$rs=$cata->query($osql);
$parentlist=$rs[0]["roue_id"];
$not_sql="select news_catas_id from ". $this->table_name. " ";
$where="where roue_id like '$parentlist,%' or roue_id='$parentlist'";
$not_sql= $not_sql.$where;
$result=$cata->query($not_sql);
// $num= $cata->where($where)->count('news_catas_id');//本次循环的纪录总数
foreach($result as $nrs){
$not_id=$nrs["news_catas_id"];
if($not_id==$current_id){//如果当前分类ID 等于不允许分类ID
$msg="<font color=\"red\">对不起,不能选择自身及自身以下分类!</font>";
//$this->ajaxReturn('',$msg,0);
echo $msg;exit;
} }
//$this->ajaxReturn('','恭喜类别选择正确!',1); //如果当前分类是根分类则直接退出
echo 1;
}
var parentid=$('#parentid');
var parentid_selectValue=parentid.val();
var currSelectIndex=$('#current_parentid').val();
var url="__URL__/no_selected";
var pars='/current_id/'+ currSelectIndex +'/source_id/'+ parentid_selectValue +'/temp/'+Math.random()+'/';
$(document).ready(function(){
$.formValidator.initConfig({formid:"Form1",onerror:function(msg){alert(msg)},onsuccess:function(){return false;}});
$("#current_parentid").formValidator({tipid:"result",onshow:"请选择目标分类!",onfocus:"目标分类不能为空!",oncorrect:"谢谢你的合作"})
.inputValidator({min:1,onerror:"目标分类不能为空!"})
.ajaxValidator({
type : "POST",
url : "__URL__/no_selected"+pars,
datatype : "html",
success : function(data){
if( data == "1" )
{
return true;
}
else
{
alert(data);
$("#result").html(data);
return false;
}
},
buttons: $("#Submit"),
error: function(){alert("服务器没有返回数据,可能服务器忙,请重试");},
onerror :'验证失败!',
onwait : "正在对用户名进行合法性校验,请稍候..."
})
});
}function no_selected(){//非正常选取
$cata= D($this->cata_table);
$current_id=$_GET["current_id"];
$source_id=$_GET["source_id"];
if (!$source_id){
// $this->ajaxReturn('','源分类不能为空!',0);
echo '源分类不能为空!';exit;
} if (!$current_id){
//$this->ajaxReturn('','目标分类不能为空!',0);
echo '目标分类不能为空!';exit;
} if ($current_id==$source_id){
$err="<font color=\"red\">对不起,源分类不能与目标分类相同!</font>";
// $this->ajaxReturn('',$err,0);
echo $err;exit;
} $osql="select roue_id,parentid from ". $this->table_name . " where news_catas_id=$source_id";
$rs=$cata->query($osql);
$parentlist=$rs[0]["roue_id"];
$not_sql="select news_catas_id from ". $this->table_name. " ";
$where="where roue_id like '$parentlist,%' or roue_id='$parentlist'";
$not_sql= $not_sql.$where;
$result=$cata->query($not_sql);
// $num= $cata->where($where)->count('news_catas_id');//本次循环的纪录总数
foreach($result as $nrs){
$not_id=$nrs["news_catas_id"];
if($not_id==$current_id){//如果当前分类ID 等于不允许分类ID
$msg="<font color=\"red\">对不起,不能选择自身及自身以下分类!</font>";
//$this->ajaxReturn('',$msg,0);
echo $msg;exit;
} }
//$this->ajaxReturn('','恭喜类别选择正确!',1); //如果当前分类是根分类则直接退出
echo 1;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货