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,...
• The most common learning algorithms: Linear and Polynomial Regression, Logistic Regression, k-Nearest Neighbors, Support Vector Machines, Decision Trees, Random Forests, and Ensemble methods. ...
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, ...
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 ...
Chapter 1: PowerShell Scripting Methods and Creating Custom Commands 7 Introduction 7 Setting up your Virtual Machine and running a test script 8 Authoring, debugging, and executing script accessing ...
Chapter 1, Practical Machine Learning with R, shows how to install and setup R environment, it covers package installation basic syntax and data types followed by reading and ...common data operation.
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 ...
the use of in silico methods to design and evaluate skin UV filters; a practical model based on the multilayer perceptron neural network (MLP) approach to predict the milling tool flank wear in a ...
Chapter 4 Common Language Runtime 145 Introduction 146 Component Architecture 148 Managed Code versus Unmanaged Code 150 Interoperability with Managed Code 152 System Namespace 153 File I/O 155...
common pitfalls, how to write efficient AJAX code, and how to achieve functionality that is easy to integrate into current and future web applications, without requiring you to rebuild the whole ...
model methods. The third and fourth recipes show how to test controller actions, and how to test that our views are showing what we expect. The last recipe shows how to run the test in a non-...
Email validation components - allow you to validate recipients email addresses, mailbox availability and also handle bounced emails. Trace Logger - provides logging functionality for storing debug ...