Authored by chenchao

1. trim value of string

2. count empty
... ... @@ -263,14 +263,22 @@ var operationEdit={
var alwaysExistsKeys=["promotionType","promotionId"];
var dynaKey_index;
var _temp={};
var emptyValCnt=0;
for(var key in reqData){
dynaKey_index=$.inArray(key,alwaysExistsKeys);
if(dynaKey_index===-1){
if(dynaKey_index===-1){
if(!reqData[key]){
emptyValCnt++;
}
_temp[key]=reqData[key];
delete reqData[key];
continue;
}
}
if(emptyValCnt>0){
common.util.__tip("没有填写数据!", "warning");
return false;
}
if($.isEmptyObject(_temp)){
common.util.__tip("没有填写数据!", "warning");
... ...
var $ = require('jquery');
var jsonUtils={
formSerializeArrayKey:{
name:"name",
... ... @@ -8,12 +9,16 @@ var jsonUtils={
var _g=this;
var result={};
var one_form_data= _params.data;
var _value;
for(var key in one_form_data){
result[one_form_data[key][_g.formSerializeArrayKey.name]]=one_form_data[key][_g.formSerializeArrayKey.value];
_value=one_form_data[key][_g.formSerializeArrayKey.value];
if(typeof(_value)==="string"){
_value=$.trim(_value);
}
result[one_form_data[key][_g.formSerializeArrayKey.name]]=_value;
}
return result;
},
}
};
module.exports = jsonUtils;
\ No newline at end of file
... ...