flymis/WebRoot/dojojs/src/validate/check.js
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.validate.check");
dojo.require("dojo.validate.common");
dojo.require("dojo.lang.common");
dojo.validate.check = function(/*HTMLFormElement*/form, /*Object*/profile){
// summary: validates user input of an HTML form based on input profile
//
// description:
// returns an object that contains several methods summarizing the results of the validation
//
// form: form to be validated
// profile: specifies how the form fields are to be validated
// {trim:Array, uppercase:Array, lowercase:Array, ucfirst:Array, digit:Array,
// required:Array, dependencies:Object, constraints:Object, confirm:Object}
// Essentially private properties of results object
var missing = [];
var invalid = [];
// results object summarizes the validation
var results = {
isSuccessful: function() {return ( !this.hasInvalid() && !this.hasMissing() );},
hasMissing: function() {return ( missing.length > 0 );},
getMissing: function() {return missing;},
isMissing: function(elemname) {
for(var i = 0; i < missing.length; i++){
if(elemname == missing[i]){ return true; }
}
return false;
},
hasInvalid: function() {return ( invalid.length > 0 );},
getInvalid: function() {return invalid;},
isInvalid: function(elemname){
for(var i = 0; i < invalid.length; i++){
if(elemname == invalid[i]){ return true; }
}
return false;
}
};
// Filters are applied before fields are validated.
// Trim removes white space at the front and end of the fields.
if(profile.trim instanceof Array){
for(var i = 0; i < profile.trim.length; i++){
var elem = form[profile.trim[i]];
if(elem.type != "text" && elem.type != "textarea" && elem.type != "password"){ continue; }
elem.value = elem.value.replace(/(^\s*|\s*$)/g, "");
}
}
// Convert to uppercase
后面还有 203 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。