IWC.CHE~*

AvatarWhat does IWC mean by? It would be "It Was Che" or "I Want Change" or "I Would Call my soul my own"^

好久没发帖子了

修改了一下《PHP Web 2.0开发实战》;

onFormSuccess:function(transport)
{
var json=transport.responseText.evalJSON(true);
var errors=$H(json.errors);
if(errors.size()>0){//当没错的时候收到空的errors[]
this.form.down('.error').show();
errors.each(function(pair){
this.showError(pair.key,pair.value);
}.bind(this));
}
else{
this.form.submit();
}
}
}
};

问题出现在空的$H().size()->0?
在firebug里找到的$H(errors).size()==38!
38个function:each;all;.....Enumerable的方法;
不知道是什么问题?高手指点下!!!

修改过的方法,在controller里增加json.success的标记。

onFormSuccess:function(transport)
{
var json=transport.responseText.evalJSON(true);
var errors=$H(json.errors);
var success=json.success;
if(success){
//this.valiEnd=true;
this.form.submit();
}
else{
if(errors.size()>0){
this.form.down('.error').show();
errors.each(function(pair){
this.showError(pair.key,pair.value);
}.bind(this));
}

}
}
};

0 评论: