Skip to content

Commit

Permalink
add idCard to validator.js
Browse files Browse the repository at this point in the history
  • Loading branch information
zkeyword committed Dec 18, 2015
1 parent f25f096 commit 812892f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dev/js/core/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,19 @@ define(['core/saogaUI'], function(saogaUI){
return c.handleText(oItem, 'phone');
}
},

/* 身份证 */
idCard: function(sVal, oItem){
sVal = sVal.trims();

if( !sVal.length ){
return false;
}

if( !/(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/.test(sVal) ){
return c.handleText(oItem, 'idCard');
}
},

/* 网址 */
url: function(sVal, oItem){
Expand Down

0 comments on commit 812892f

Please sign in to comment.