var Messages = {
……
addSuccessMess:"Add
Successfully!",
unnull : " can't be blank.",
numberrequired : "Please
enter a valid positive integer.",
maxsize : "The maximal size is
",
maxlength : "the longest character
size is ",
daterequired : "Please
enter a valid date in the format 'MM/dd/yyyy'.",
duplicatedField : " cant
not be Duplicated."
……
};
function
checkMaxSize(value, maxsize) {
if ($.trim(value).length >
maxsize) {
return
Messages.maxsize + maxsize + ".";
}
return "";
}
function
checkLength(value, maxlength,titleName) {
if ($.trim(value).length >
maxlength) {
alert(titleName+","+Messages.maxlength
+ maxlength + ".");
return false;
}
return true;
}
function
checkNullAndNumber(param) {
var val = param.value;
if (val.length > 0) {
for ( var i = 0; i <
val.length; i++) {
c =
val.charAt(i).charCodeAt();
if (c == 45 || i
== 0) {
continue;
}
if (c < 48 || c
> 57) {
$('.error').show("slow").html("Must be
integral number!");
event.preventDefault();
return false;
} else {
$('.error').hide();
}
}
} else {
$('.error').show("slow").text("Can't be
blank.");
event.preventDefault();
return false;
}
}
function
checkNull(value) {
if ($.trim(value).length <= 0) {
return Messages.unnull;
}
return "";
}
function
checkNumber(value) {
if ($.trim(value).length == 0)
return "";
for ( var i = 0; i <
value.length; i++) {
c = value.charAt(i).charCodeAt();
if (c == 45) {
continue;
}
if (c < 48 || c
> 57) {
//
$('.error').show("slow").html("Must be integral
number!");
return
Messages.numberrequired;
}
}
return "";
}
function
checkIsPositiveInteger(value){
var reg = /^\d+$/;
return
reg.test($.trim(value));
}
function
checkDate(value) {
if ($.trim(value).length == 0)
return "";
var r = value.match(/(0[1-9]|1[012])[\/](0[1-9]|[12][0-9]|3[01])[\/](19|20)\d\d/);
if (r == null) {
return
Messages.daterequired;
}
return "";
}
function
checkStartDateGreatThanEndDate(startDate,endDate){
if(startDate.length>0&&endDate.length>0){
if( Date.parse(startDate)>Date.parse(endDate)){
return false;
}
}
return true;
}
分享到:
相关推荐
Crc check described in detail the basic principles of complaints by example about the crc checksum generation method, crc check is the most common form of communication data validation methods.
This book also covers validation methods to insure that the data provided by a user is good before the data is entered into an array. You’ll see how ...
• Selecting a model and tuning hyperparameters using cross-validation. • The main challenges of Machine Learning, in particular underfitting and overfitting (the bias/variance tradeoff). • Reducing...
2.5 Common Distributions Binomial Poisson Uniform Normal Exponential Gamma Chi-Square Weibull Beta Multivariate Normal 2.6 MATLAB Code 2.7 Further Reading Exercises Chapter...
2.5 Common Distributions Binomial Poisson Uniform Normal Exponential Gamma Chi-Square Weibull Beta Multivariate Normal 2.6 MATLAB Code 2.7 Further Reading Exercises Chapter...
2.5 Common Distributions Binomial Poisson Uniform Normal Exponential Gamma Chi-Square Weibull Beta Multivariate Normal 2.6 MATLAB Code 2.7 Further Reading Exercises Chapter...
2.5 Common Distributions Binomial Poisson Uniform Normal Exponential Gamma Chi-Square Weibull Beta Multivariate Normal 2.6 MATLAB Code 2.7 Further Reading Exercises Chapter...
The most common learning algorithms: Linear and Polynomial Regression, Logistic Regression, k-Nearest Neighbors, Support Vector Machines, Decision Trees, Random Forests, and Ensemble methods. Part II,...
Cluster analysis is used in data mining and is a common technique for statistical data analysis used in many fields of study, such as the medical & life sciences, behavioral & social sciences, ...
- **Business Logic Components**: Formula fields, validation rules, workflow rules, and approval processes automate business processes. - **Security and Permission Settings**: Controlling access to ...
Get solutions to common NHibernate problems to develop high-quality performance-critical data access applications What you will learn from this book : Create a persistent object model for moving data...
Chapter 8: Using the Windows Common Controls Overview Common Control Basics Initializing the Common Controls Library Notifications Image Lists Image Masks List Views and Image Lists ...
Using Bean Validation 174 Chapter 10: Java Servlet Technology 179 What Is a Servlet? 180 Servlet Lifecycle 180 Sharing Information 182 Creating and Initializing a Servlet 183 Writing Service ...
- **Configuring Record Expiration Policy**: Scripts can be created to configure a common record expiration policy, ensuring that records are retained only for the required period. #### Chapter 9: ...