mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
V 3.5 RC 1
This commit is contained in:
71
www/include/jslibs/jquery-validation/test/events.html
Normal file
71
www/include/jslibs/jquery-validation/test/events.html
Normal file
@@ -0,0 +1,71 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="firebug/firebug.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
var handler = {
|
||||
focusin: function() {
|
||||
$(this).addClass("focus");
|
||||
},
|
||||
focusout: function() {
|
||||
$(this).removeClass("focus");
|
||||
}
|
||||
}
|
||||
$("#commentForm").delegate("focusin focusout", ":text, textarea", function(event) {
|
||||
/*
|
||||
this.addClass("focus").one("blur", function() {
|
||||
$(this).removeClass("focus");
|
||||
});
|
||||
*/
|
||||
handler[event.type].call(this, arguments);
|
||||
});
|
||||
$("#remove").click(function() {
|
||||
$("#commentForm").unbind("focusin");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#commentForm { width: 500px; }
|
||||
#commentForm label { width: 250px; display: block; float: left; }
|
||||
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
|
||||
.focus { background-color: red; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname">Name (required, at least 2 characters)</label>
|
||||
<input id="cname" name="name" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail">E-Mail (required)</label>
|
||||
<input id="cemail" name="email" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl">URL (optional)</label>
|
||||
<input id="curl" name="url" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment">Your comment (required)</label>
|
||||
<textarea id="ccomment" name="comment" class="{required:true}"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<button id="remove">Remove focus handler</button>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
www/include/jslibs/jquery-validation/test/firebug/errorIcon.png
Normal file
BIN
www/include/jslibs/jquery-validation/test/firebug/errorIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 457 B |
209
www/include/jslibs/jquery-validation/test/firebug/firebug.css
Normal file
209
www/include/jslibs/jquery-validation/test/firebug/firebug.css
Normal file
@@ -0,0 +1,209 @@
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
background: #FFFFFF;
|
||||
font-family: Lucida Grande, Tahoma, sans-serif;
|
||||
font-size: 11px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
height: 14px;
|
||||
border-top: 1px solid ThreeDHighlight;
|
||||
border-bottom: 1px solid ThreeDShadow;
|
||||
padding: 2px 6px;
|
||||
background: ThreeDFace;
|
||||
}
|
||||
|
||||
.toolbarRight {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
#log {
|
||||
overflow: auto;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#commandLine {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 18px;
|
||||
border: none;
|
||||
border-top: 1px solid ThreeDShadow;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow {
|
||||
position: relative;
|
||||
border-bottom: 1px solid #D7D7D7;
|
||||
padding: 2px 4px 1px 6px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.logRow-command {
|
||||
font-family: Monaco, monospace;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.objectBox-null {
|
||||
padding: 0 2px;
|
||||
border: 1px solid #666666;
|
||||
background-color: #888888;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.objectBox-string {
|
||||
font-family: Monaco, monospace;
|
||||
color: red;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.objectBox-number {
|
||||
color: #000088;
|
||||
}
|
||||
|
||||
.objectBox-function {
|
||||
font-family: Monaco, monospace;
|
||||
color: DarkGreen;
|
||||
}
|
||||
|
||||
.objectBox-object {
|
||||
color: DarkGreen;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow-info,
|
||||
.logRow-error,
|
||||
.logRow-warning {
|
||||
background: #FFFFFF no-repeat 2px 2px;
|
||||
padding-left: 20px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
|
||||
.logRow-info {
|
||||
background-image: url(infoIcon.png);
|
||||
}
|
||||
|
||||
.logRow-warning {
|
||||
background-color: cyan;
|
||||
background-image: url(warningIcon.png);
|
||||
}
|
||||
|
||||
.logRow-error {
|
||||
background-color: LightYellow;
|
||||
background-image: url(errorIcon.png);
|
||||
}
|
||||
|
||||
.errorMessage {
|
||||
vertical-align: top;
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.objectBox-sourceLink {
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 2px;
|
||||
padding-left: 8px;
|
||||
font-family: Lucida Grande, sans-serif;
|
||||
font-weight: bold;
|
||||
color: #0000FF;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow-group {
|
||||
background: #EEEEEE;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.logGroup {
|
||||
background: #EEEEEE;
|
||||
}
|
||||
|
||||
.logGroupBox {
|
||||
margin-left: 24px;
|
||||
border-top: 1px solid #D7D7D7;
|
||||
border-left: 1px solid #D7D7D7;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.selectorTag,
|
||||
.selectorId,
|
||||
.selectorClass {
|
||||
font-family: Monaco, monospace;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.selectorTag {
|
||||
color: #0000FF;
|
||||
}
|
||||
|
||||
.selectorId {
|
||||
color: DarkBlue;
|
||||
}
|
||||
|
||||
.selectorClass {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.objectBox-element {
|
||||
font-family: Monaco, monospace;
|
||||
color: #000088;
|
||||
}
|
||||
|
||||
.nodeChildren {
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.nodeTag {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.nodeValue {
|
||||
color: #FF0000;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.nodeText,
|
||||
.nodeComment {
|
||||
margin: 0 2px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.nodeText {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.nodeComment {
|
||||
color: DarkGreen;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.propertyNameCell {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.propertyName {
|
||||
font-weight: bold;
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Firebug</title>
|
||||
<link rel="stylesheet" type="text/css" href="firebug.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="#" onclick="parent.console.clear()">Clear</a>
|
||||
<span class="toolbarRight">
|
||||
<a href="#" onclick="parent.console.close()">Close</a>
|
||||
</span>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
<input type="text" id="commandLine">
|
||||
|
||||
<script>parent.onFirebugReady(document);</script>
|
||||
</body>
|
||||
</html>
|
672
www/include/jslibs/jquery-validation/test/firebug/firebug.js
vendored
Normal file
672
www/include/jslibs/jquery-validation/test/firebug/firebug.js
vendored
Normal file
@@ -0,0 +1,672 @@
|
||||
|
||||
if (!("console" in window) || !("firebug" in console)) {
|
||||
(function()
|
||||
{
|
||||
window.console =
|
||||
{
|
||||
log: function()
|
||||
{
|
||||
logFormatted(arguments, "");
|
||||
},
|
||||
|
||||
debug: function()
|
||||
{
|
||||
logFormatted(arguments, "debug");
|
||||
},
|
||||
|
||||
info: function()
|
||||
{
|
||||
logFormatted(arguments, "info");
|
||||
},
|
||||
|
||||
warn: function()
|
||||
{
|
||||
logFormatted(arguments, "warning");
|
||||
},
|
||||
|
||||
error: function()
|
||||
{
|
||||
logFormatted(arguments, "error");
|
||||
},
|
||||
|
||||
assert: function(truth, message)
|
||||
{
|
||||
if (!truth)
|
||||
{
|
||||
var args = [];
|
||||
for (var i = 1; i < arguments.length; ++i)
|
||||
args.push(arguments[i]);
|
||||
|
||||
logFormatted(args.length ? args : ["Assertion Failure"], "error");
|
||||
throw message ? message : "Assertion Failure";
|
||||
}
|
||||
},
|
||||
|
||||
dir: function(object)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var pairs = [];
|
||||
for (var name in object)
|
||||
{
|
||||
try
|
||||
{
|
||||
pairs.push([name, object[name]]);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
pairs.sort(function(a, b) { return a[0] < b[0] ? -1 : 1; });
|
||||
|
||||
html.push('<table>');
|
||||
for (var i = 0; i < pairs.length; ++i)
|
||||
{
|
||||
var name = pairs[i][0], value = pairs[i][1];
|
||||
|
||||
html.push('<tr>',
|
||||
'<td class="propertyNameCell"><span class="propertyName">',
|
||||
escapeHTML(name), '</span></td>', '<td><span class="propertyValue">');
|
||||
appendObject(value, html);
|
||||
html.push('</span></td></tr>');
|
||||
}
|
||||
html.push('</table>');
|
||||
|
||||
logRow(html, "dir");
|
||||
},
|
||||
|
||||
dirxml: function(node)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
appendNode(node, html);
|
||||
logRow(html, "dirxml");
|
||||
},
|
||||
|
||||
group: function()
|
||||
{
|
||||
logRow(arguments, "group", pushGroup);
|
||||
},
|
||||
|
||||
groupEnd: function()
|
||||
{
|
||||
logRow(arguments, "", popGroup);
|
||||
},
|
||||
|
||||
time: function(name)
|
||||
{
|
||||
timeMap[name] = (new Date()).getTime();
|
||||
},
|
||||
|
||||
timeEnd: function(name)
|
||||
{
|
||||
if (name in timeMap)
|
||||
{
|
||||
var delta = (new Date()).getTime() - timeMap[name];
|
||||
logFormatted([name+ ":", delta+"ms"]);
|
||||
delete timeMap[name];
|
||||
}
|
||||
},
|
||||
|
||||
count: function()
|
||||
{
|
||||
this.warn(["count() not supported."]);
|
||||
},
|
||||
|
||||
trace: function()
|
||||
{
|
||||
this.warn(["trace() not supported."]);
|
||||
},
|
||||
|
||||
profile: function()
|
||||
{
|
||||
this.warn(["profile() not supported."]);
|
||||
},
|
||||
|
||||
profileEnd: function()
|
||||
{
|
||||
},
|
||||
|
||||
clear: function()
|
||||
{
|
||||
consoleBody.innerHTML = "";
|
||||
},
|
||||
|
||||
open: function()
|
||||
{
|
||||
toggleConsole(true);
|
||||
},
|
||||
|
||||
close: function()
|
||||
{
|
||||
if (frameVisible)
|
||||
toggleConsole();
|
||||
}
|
||||
};
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
var consoleFrame = null;
|
||||
var consoleBody = null;
|
||||
var commandLine = null;
|
||||
|
||||
var frameVisible = false;
|
||||
var messageQueue = [];
|
||||
var groupStack = [];
|
||||
var timeMap = {};
|
||||
|
||||
var clPrefix = ">>> ";
|
||||
|
||||
var isFirefox = navigator.userAgent.indexOf("Firefox") != -1;
|
||||
var isIE = navigator.userAgent.indexOf("MSIE") != -1;
|
||||
var isOpera = navigator.userAgent.indexOf("Opera") != -1;
|
||||
var isSafari = navigator.userAgent.indexOf("AppleWebKit") != -1;
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function toggleConsole(forceOpen)
|
||||
{
|
||||
frameVisible = forceOpen || !frameVisible;
|
||||
if (consoleFrame)
|
||||
consoleFrame.style.visibility = frameVisible ? "visible" : "hidden";
|
||||
else
|
||||
waitForBody();
|
||||
}
|
||||
|
||||
function focusCommandLine()
|
||||
{
|
||||
toggleConsole(true);
|
||||
if (commandLine)
|
||||
commandLine.focus();
|
||||
}
|
||||
|
||||
function waitForBody()
|
||||
{
|
||||
if (document.body)
|
||||
createFrame();
|
||||
else
|
||||
setTimeout(waitForBody, 200);
|
||||
}
|
||||
|
||||
function createFrame()
|
||||
{
|
||||
if (consoleFrame)
|
||||
return;
|
||||
|
||||
window.onFirebugReady = function(doc)
|
||||
{
|
||||
window.onFirebugReady = null;
|
||||
|
||||
var toolbar = doc.getElementById("toolbar");
|
||||
toolbar.onmousedown = onSplitterMouseDown;
|
||||
|
||||
commandLine = doc.getElementById("commandLine");
|
||||
addEvent(commandLine, "keydown", onCommandLineKeyDown);
|
||||
|
||||
addEvent(doc, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
|
||||
|
||||
consoleBody = doc.getElementById("log");
|
||||
layout();
|
||||
flush();
|
||||
}
|
||||
|
||||
var baseURL = getFirebugURL();
|
||||
|
||||
consoleFrame = document.createElement("iframe");
|
||||
consoleFrame.setAttribute("src", baseURL+"/firebug.html");
|
||||
consoleFrame.setAttribute("frameBorder", "0");
|
||||
consoleFrame.style.visibility = (frameVisible ? "visible" : "hidden");
|
||||
consoleFrame.style.zIndex = "2147483647";
|
||||
consoleFrame.style.position = "fixed";
|
||||
consoleFrame.style.width = "100%";
|
||||
consoleFrame.style.left = "0";
|
||||
consoleFrame.style.bottom = "0";
|
||||
consoleFrame.style.height = "200px";
|
||||
document.body.appendChild(consoleFrame);
|
||||
}
|
||||
|
||||
function getFirebugURL()
|
||||
{
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
for (var i = 0; i < scripts.length; ++i)
|
||||
{
|
||||
if (scripts[i].src.indexOf("firebug.js") != -1)
|
||||
{
|
||||
var lastSlash = scripts[i].src.lastIndexOf("/");
|
||||
return scripts[i].src.substr(0, lastSlash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function evalCommandLine()
|
||||
{
|
||||
var text = commandLine.value;
|
||||
commandLine.value = "";
|
||||
|
||||
logRow([clPrefix, text], "command");
|
||||
|
||||
var value;
|
||||
try
|
||||
{
|
||||
value = eval(text);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
function layout()
|
||||
{
|
||||
var toolbar = consoleBody.ownerDocument.getElementById("toolbar");
|
||||
var height = consoleFrame.offsetHeight - (toolbar.offsetHeight + commandLine.offsetHeight);
|
||||
consoleBody.style.top = toolbar.offsetHeight + "px";
|
||||
consoleBody.style.height = height + "px";
|
||||
|
||||
commandLine.style.top = (consoleFrame.offsetHeight - commandLine.offsetHeight) + "px";
|
||||
}
|
||||
|
||||
function logRow(message, className, handler)
|
||||
{
|
||||
if (consoleBody)
|
||||
writeMessage(message, className, handler);
|
||||
else
|
||||
{
|
||||
messageQueue.push([message, className, handler]);
|
||||
waitForBody();
|
||||
}
|
||||
}
|
||||
|
||||
function flush()
|
||||
{
|
||||
var queue = messageQueue;
|
||||
messageQueue = [];
|
||||
|
||||
for (var i = 0; i < queue.length; ++i)
|
||||
writeMessage(queue[i][0], queue[i][1], queue[i][2]);
|
||||
}
|
||||
|
||||
function writeMessage(message, className, handler)
|
||||
{
|
||||
var isScrolledToBottom =
|
||||
consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight;
|
||||
|
||||
if (!handler)
|
||||
handler = writeRow;
|
||||
|
||||
handler(message, className);
|
||||
|
||||
if (isScrolledToBottom)
|
||||
consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight;
|
||||
}
|
||||
|
||||
function appendRow(row)
|
||||
{
|
||||
var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody;
|
||||
container.appendChild(row);
|
||||
}
|
||||
|
||||
function writeRow(message, className)
|
||||
{
|
||||
var row = consoleBody.ownerDocument.createElement("div");
|
||||
row.className = "logRow" + (className ? " logRow-"+className : "");
|
||||
row.innerHTML = message.join("");
|
||||
appendRow(row);
|
||||
}
|
||||
|
||||
function pushGroup(message, className)
|
||||
{
|
||||
logFormatted(message, className);
|
||||
|
||||
var groupRow = consoleBody.ownerDocument.createElement("div");
|
||||
groupRow.className = "logGroup";
|
||||
var groupRowBox = consoleBody.ownerDocument.createElement("div");
|
||||
groupRowBox.className = "logGroupBox";
|
||||
groupRow.appendChild(groupRowBox);
|
||||
appendRow(groupRowBox);
|
||||
groupStack.push(groupRowBox);
|
||||
}
|
||||
|
||||
function popGroup()
|
||||
{
|
||||
groupStack.pop();
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function logFormatted(objects, className)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var format = objects[0];
|
||||
var objIndex = 0;
|
||||
|
||||
if (typeof(format) != "string")
|
||||
{
|
||||
format = "";
|
||||
objIndex = -1;
|
||||
}
|
||||
|
||||
var parts = parseFormat(format);
|
||||
for (var i = 0; i < parts.length; ++i)
|
||||
{
|
||||
var part = parts[i];
|
||||
if (part && typeof(part) == "object")
|
||||
{
|
||||
var object = objects[++objIndex];
|
||||
part.appender(object, html);
|
||||
}
|
||||
else
|
||||
appendText(part, html);
|
||||
}
|
||||
|
||||
for (var i = objIndex+1; i < objects.length; ++i)
|
||||
{
|
||||
appendText(" ", html);
|
||||
|
||||
var object = objects[i];
|
||||
if (typeof(object) == "string")
|
||||
appendText(object, html);
|
||||
else
|
||||
appendObject(object, html);
|
||||
}
|
||||
|
||||
logRow(html, className);
|
||||
}
|
||||
|
||||
function parseFormat(format)
|
||||
{
|
||||
var parts = [];
|
||||
|
||||
var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;
|
||||
var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat};
|
||||
|
||||
for (var m = reg.exec(format); m; m = reg.exec(format))
|
||||
{
|
||||
var type = m[8] ? m[8] : m[5];
|
||||
var appender = type in appenderMap ? appenderMap[type] : appendObject;
|
||||
var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0);
|
||||
|
||||
parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1));
|
||||
parts.push({appender: appender, precision: precision});
|
||||
|
||||
format = format.substr(m.index+m[0].length);
|
||||
}
|
||||
|
||||
parts.push(format);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function escapeHTML(value)
|
||||
{
|
||||
function replaceChars(ch)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case "&":
|
||||
return "&";
|
||||
case "'":
|
||||
return "'";
|
||||
case '"':
|
||||
return """;
|
||||
}
|
||||
return "?";
|
||||
};
|
||||
return String(value).replace(/[<>&"']/g, replaceChars);
|
||||
}
|
||||
|
||||
function objectToString(object)
|
||||
{
|
||||
try
|
||||
{
|
||||
return object+"";
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function appendText(object, html)
|
||||
{
|
||||
html.push(escapeHTML(objectToString(object)));
|
||||
}
|
||||
|
||||
function appendNull(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-null">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendString(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-string">"', escapeHTML(objectToString(object)),
|
||||
'"</span>');
|
||||
}
|
||||
|
||||
function appendInteger(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendFloat(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendFunction(object, html)
|
||||
{
|
||||
var reName = /function ?(.*?)\(/;
|
||||
var m = reName.exec(objectToString(object));
|
||||
var name = m ? m[1] : "function";
|
||||
html.push('<span class="objectBox-function">', escapeHTML(name), '()</span>');
|
||||
}
|
||||
|
||||
function appendObject(object, html)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (object == undefined)
|
||||
appendNull("undefined", html);
|
||||
else if (object == null)
|
||||
appendNull("null", html);
|
||||
else if (typeof object == "string")
|
||||
appendString(object, html);
|
||||
else if (typeof object == "number")
|
||||
appendInteger(object, html);
|
||||
else if (typeof object == "function")
|
||||
appendFunction(object, html);
|
||||
else if (object.nodeType == 1)
|
||||
appendSelector(object, html);
|
||||
else if (typeof object == "object")
|
||||
appendObjectFormatted(object, html);
|
||||
else
|
||||
appendText(object, html);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
function appendObjectFormatted(object, html)
|
||||
{
|
||||
var text = objectToString(object);
|
||||
var reObject = /\[object (.*?)\]/;
|
||||
|
||||
var m = reObject.exec(text);
|
||||
html.push('<span class="objectBox-object">', m ? m[1] : text, '</span>')
|
||||
}
|
||||
|
||||
function appendSelector(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-selector">');
|
||||
|
||||
html.push('<span class="selectorTag">', escapeHTML(object.nodeName.toLowerCase()), '</span>');
|
||||
if (object.id)
|
||||
html.push('<span class="selectorId">#', escapeHTML(object.id), '</span>');
|
||||
if (object.className)
|
||||
html.push('<span class="selectorClass">.', escapeHTML(object.className), '</span>');
|
||||
|
||||
html.push('</span>');
|
||||
}
|
||||
|
||||
function appendNode(node, html)
|
||||
{
|
||||
if (node.nodeType == 1)
|
||||
{
|
||||
html.push(
|
||||
'<div class="objectBox-element">',
|
||||
'<<span class="nodeTag">', node.nodeName.toLowerCase(), '</span>');
|
||||
|
||||
for (var i = 0; i < node.attributes.length; ++i)
|
||||
{
|
||||
var attr = node.attributes[i];
|
||||
if (!attr.specified)
|
||||
continue;
|
||||
|
||||
html.push(' <span class="nodeName">', attr.nodeName.toLowerCase(),
|
||||
'</span>="<span class="nodeValue">', escapeHTML(attr.nodeValue),
|
||||
'</span>"')
|
||||
}
|
||||
|
||||
if (node.firstChild)
|
||||
{
|
||||
html.push('></div><div class="nodeChildren">');
|
||||
|
||||
for (var child = node.firstChild; child; child = child.nextSibling)
|
||||
appendNode(child, html);
|
||||
|
||||
html.push('</div><div class="objectBox-element"></<span class="nodeTag">',
|
||||
node.nodeName.toLowerCase(), '></span></div>');
|
||||
}
|
||||
else
|
||||
html.push('/></div>');
|
||||
}
|
||||
else if (node.nodeType == 3)
|
||||
{
|
||||
html.push('<div class="nodeText">', escapeHTML(node.nodeValue),
|
||||
'</div>');
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function addEvent(object, name, handler)
|
||||
{
|
||||
if (document.all)
|
||||
object.attachEvent("on"+name, handler);
|
||||
else
|
||||
object.addEventListener(name, handler, false);
|
||||
}
|
||||
|
||||
function removeEvent(object, name, handler)
|
||||
{
|
||||
if (document.all)
|
||||
object.detachEvent("on"+name, handler);
|
||||
else
|
||||
object.removeEventListener(name, handler, false);
|
||||
}
|
||||
|
||||
function cancelEvent(event)
|
||||
{
|
||||
if (document.all)
|
||||
event.cancelBubble = true;
|
||||
else
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function onError(msg, href, lineNo)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var lastSlash = href.lastIndexOf("/");
|
||||
var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1);
|
||||
|
||||
html.push(
|
||||
'<span class="errorMessage">', msg, '</span>',
|
||||
'<div class="objectBox-sourceLink">', fileName, ' (line ', lineNo, ')</div>'
|
||||
);
|
||||
|
||||
logRow(html, "error");
|
||||
};
|
||||
|
||||
function onKeyDown(event)
|
||||
{
|
||||
if (event.keyCode == 123)
|
||||
toggleConsole();
|
||||
else if ((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey
|
||||
&& (event.metaKey || event.ctrlKey))
|
||||
focusCommandLine();
|
||||
else
|
||||
return;
|
||||
|
||||
cancelEvent(event);
|
||||
}
|
||||
|
||||
function onSplitterMouseDown(event)
|
||||
{
|
||||
if (isSafari || isOpera)
|
||||
return;
|
||||
|
||||
addEvent(document, "mousemove", onSplitterMouseMove);
|
||||
addEvent(document, "mouseup", onSplitterMouseUp);
|
||||
|
||||
for (var i = 0; i < frames.length; ++i)
|
||||
{
|
||||
addEvent(frames[i].document, "mousemove", onSplitterMouseMove);
|
||||
addEvent(frames[i].document, "mouseup", onSplitterMouseUp);
|
||||
}
|
||||
}
|
||||
|
||||
function onSplitterMouseMove(event)
|
||||
{
|
||||
var win = document.all
|
||||
? event.srcElement.ownerDocument.parentWindow
|
||||
: event.target.ownerDocument.defaultView;
|
||||
|
||||
var clientY = event.clientY;
|
||||
if (win != win.parent)
|
||||
clientY += win.frameElement ? win.frameElement.offsetTop : 0;
|
||||
|
||||
var height = consoleFrame.offsetTop + consoleFrame.clientHeight;
|
||||
var y = height - clientY;
|
||||
|
||||
consoleFrame.style.height = y + "px";
|
||||
layout();
|
||||
}
|
||||
|
||||
function onSplitterMouseUp(event)
|
||||
{
|
||||
removeEvent(document, "mousemove", onSplitterMouseMove);
|
||||
removeEvent(document, "mouseup", onSplitterMouseUp);
|
||||
|
||||
for (var i = 0; i < frames.length; ++i)
|
||||
{
|
||||
removeEvent(frames[i].document, "mousemove", onSplitterMouseMove);
|
||||
removeEvent(frames[i].document, "mouseup", onSplitterMouseUp);
|
||||
}
|
||||
}
|
||||
|
||||
function onCommandLineKeyDown(event)
|
||||
{
|
||||
if (event.keyCode == 13)
|
||||
evalCommandLine();
|
||||
else if (event.keyCode == 27)
|
||||
commandLine.value = "";
|
||||
}
|
||||
|
||||
window.onerror = onError;
|
||||
addEvent(document, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
|
||||
|
||||
if (document.documentElement.getAttribute("debug") == "true")
|
||||
toggleConsole(true);
|
||||
})();
|
||||
}
|
10
www/include/jslibs/jquery-validation/test/firebug/firebugx.js
vendored
Normal file
10
www/include/jslibs/jquery-validation/test/firebug/firebugx.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
if (!("console" in window) || !("firebug" in console))
|
||||
{
|
||||
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
||||
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
||||
|
||||
window.console = {};
|
||||
for (var i = 0; i < names.length; ++i)
|
||||
window.console[names[i]] = function() {}
|
||||
}
|
BIN
www/include/jslibs/jquery-validation/test/firebug/infoIcon.png
Normal file
BIN
www/include/jslibs/jquery-validation/test/firebug/infoIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 524 B |
Binary file not shown.
After Width: | Height: | Size: 516 B |
261
www/include/jslibs/jquery-validation/test/index-14.html
Normal file
261
www/include/jslibs/jquery-validation/test/index-14.html
Normal file
@@ -0,0 +1,261 @@
|
||||
<!DOCTYPE html>
|
||||
<html id="html">
|
||||
<head>
|
||||
<title>jQuery - Validation Test Suite</title>
|
||||
<link rel="Stylesheet" media="screen" href="qunit/testsuite.css" />
|
||||
<script type="text/javascript" src="../lib/jquery-1.4.2.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.metadata.js"></script>
|
||||
<script type="text/javascript" src="../jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="../additional-methods.js"></script>
|
||||
<script type="text/javascript" src="test.js"></script>
|
||||
<script type="text/javascript" src="rules.js"></script>
|
||||
<script type="text/javascript" src="messages.js"></script>
|
||||
<script type="text/javascript" src="methods.js"></script>
|
||||
</head>
|
||||
<body id="body">
|
||||
<h1><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Test Suite</h1>
|
||||
<h2 id="banner"></h2>
|
||||
<h2 id="userAgent"></h2>
|
||||
|
||||
<!-- Test HTML -->
|
||||
<div id="other" style="display:none;">
|
||||
<input type="password" name="pw1" id="pw1" value="engfeh" />
|
||||
<input type="password" name="pw2" id="pw2" value="" />
|
||||
</div>
|
||||
<div id="main" style="position: absolute; top: -10000px; left: -10000px;">
|
||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/">Google Groups</a>.
|
||||
This link has <code><a href="#" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
<div id="foo">
|
||||
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
|
||||
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
|
||||
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
|
||||
|
||||
</div>
|
||||
<p id="first">Try them out:</p>
|
||||
<ul id="firstUL"></ul>
|
||||
<ol id="empty"></ol>
|
||||
|
||||
<form id="testForm1">
|
||||
<input class="{required:true,minlength:2}" title="buga" name="firstname" id="firstname" />
|
||||
<label id="errorFirstname" for="firstname" class="error">error for firstname</label>
|
||||
<input class="{required:true}" title="buga" name="lastname" id="lastname" />
|
||||
<input class="{required:true}" title="something" name="something" id="something" value="something" />
|
||||
</form>
|
||||
|
||||
<form id="testForm1clean">
|
||||
<input title="buga" name="firstname" id="firstnamec" />
|
||||
<label id="errorFirstname" for="firstname" class="error">error for firstname</label>
|
||||
<input title="buga" name="lastname" id="lastnamec" />
|
||||
<input name="username" id="usernamec" />
|
||||
</form>
|
||||
|
||||
<form id="userForm">
|
||||
<input class="{required:true}" name="username" id="username" />
|
||||
<input type="submit" name="submitButton" value="submitButtonValue" />
|
||||
</form>
|
||||
|
||||
<form method="post" id="signupForm" action="../demo/form.php">
|
||||
<input id="user" name="user" title="Please enter your username (at least 3 characters)" class="{required:true,minlength:3}" />
|
||||
<input type="password" name="password" id="password" class="{required:true,minlength:5}" />
|
||||
</form>
|
||||
|
||||
<form id="testForm2">
|
||||
<input class="{required:true}" type="radio" name="agree" id="agb" />
|
||||
<label for="agree" id="agreeLabel" class="xerror">error for agb</label>
|
||||
</form>
|
||||
|
||||
<form id="testForm3">
|
||||
<select class="{required:true}" name="meal" id="meal" >
|
||||
<option value="">Please select...</option>
|
||||
<option value="1">Food</option>
|
||||
<option value="2">Milk</option>
|
||||
</select>
|
||||
</form>
|
||||
<div class="error" id="errorContainer">
|
||||
<ul>
|
||||
<li class="error" id="errorWrapper">
|
||||
<label for="meal" id="mealLabel" class="error">error for meal</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form id="testForm4">
|
||||
<input class="{foo:true}" name="f1" id="f1" />
|
||||
<input class="{bar:true}" name="f2" id="f2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm5">
|
||||
<input class="{equalTo:'#x2'}" value="x" name="x1" id="x1" />
|
||||
<input class="{equalTo:'#x1'}" value="y" name="x2" id="x2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm6">
|
||||
<input class="{required:true,minlength:2}" type="checkbox" name="check" id="form6check1" />
|
||||
<input type="checkbox" name="check" id="form6check2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm7">
|
||||
<select class="{required:true,minlength:2}" name="selectf7" id="selectf7" multiple="multiple">
|
||||
<option id="optionxa" value="0">0</option>
|
||||
<option id="optionxb" value="1">1</option>
|
||||
<option id="optionxc" value="2">2</option>
|
||||
<option id="optionxd" value="3">3</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form id="dateRangeForm">
|
||||
<input id="fromDate" name="fromDate" class="requiredDateRange" value="x" />
|
||||
<input id="toDate" name="toDate" class="requiredDateRange" value="y" />
|
||||
<span class="errorContainer"></span>
|
||||
</form>
|
||||
|
||||
<form id="testForm8">
|
||||
<input id="form8input" class="{required:true,number:true,rangelength:[2,8]}" name="abc" />
|
||||
<input type="radio" name="radio1"/>
|
||||
</form>
|
||||
|
||||
<form id="testForm9">
|
||||
<input id="testEmail9" class="{required:true,email:true,messages:{required:'required',email:'email'}}" />
|
||||
</form>
|
||||
|
||||
<div id="simplecontainer">
|
||||
<h3></h3>
|
||||
</div>
|
||||
|
||||
<div id="container"></div>
|
||||
|
||||
<ol id="labelcontainer"></ol>
|
||||
|
||||
<form id="elementsOrder">
|
||||
<select class="required" name="order1" id="order1"><option value="">none</option></select>
|
||||
<input class="required" name="order2" id="order2"/>
|
||||
<input class="required" name="order3" type="checkbox" id="order3"/>
|
||||
<input class="required" name="order4" id="order4"/>
|
||||
<input class="required" name="order5" type="radio" id="order5"/>
|
||||
<input class="required" name="order6" id="order6"/>
|
||||
<ul id="orderContainer">
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
<form id="form" action="formaction">
|
||||
<input type="text" name="action" value="Test" id="text1"/>
|
||||
<input type="text" name="text2" value=" " id="text1b"/>
|
||||
<input type="text" name="text2" value="T " id="text1c"/>
|
||||
<input type="text" name="text2" value="T" id="text2"/>
|
||||
<input type="text" name="text2" value="TestTestTest" id="text3"/>
|
||||
|
||||
<input type="text" name="action" value="0" id="value1"/>
|
||||
<input type="text" name="text2" value="10" id="value2"/>
|
||||
<input type="text" name="text2" value="1000" id="value3"/>
|
||||
|
||||
<input type="radio" name="radio1" id="radio1"/>
|
||||
<input type="radio" name="radio1" id="radio1a"/>
|
||||
<input type="radio" name="radio2" id="radio2" checked="checked"/>
|
||||
<input type="radio" name="radio" id="radio3"/>
|
||||
<input type="radio" name="radio" id="radio4" checked="checked"/>
|
||||
|
||||
<input type="checkbox" name="check" id="check1" checked="checked"/>
|
||||
<input type="checkbox" name="check" id="check1b" />
|
||||
|
||||
<input type="checkbox" name="check2" id="check2"/>
|
||||
|
||||
<input type="checkbox" name="check3" id="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
|
||||
<input type="hidden" name="hidden" id="hidden1"/>
|
||||
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
|
||||
|
||||
<input type="text" readonly="readonly" id="name" name="name" value="name" />
|
||||
|
||||
<button name="button">Button</button>
|
||||
|
||||
<textarea id="area1" name="area1"">foobar</textarea>
|
||||
|
||||
|
||||
<textarea id="area2" name="area2"></textarea>
|
||||
|
||||
<select name="select1" id="select1">
|
||||
<option id="option1a" value="">Nothing</option>
|
||||
<option id="option1b" value="1">1</option>
|
||||
<option id="option1c" value="2">2</option>
|
||||
<option id="option1d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select2" id="select2">
|
||||
<option id="option2a" value="">Nothing</option>
|
||||
<option id="option2b" value="1">1</option>
|
||||
<option id="option2c" value="2">2</option>
|
||||
<option id="option2d" selected="selected" value="3">3</option>
|
||||
</select>
|
||||
<select name="select3" id="select3" multiple="multiple">
|
||||
<option id="option3a" value="">Nothing</option>
|
||||
<option id="option3b" selected="selected" value="1">1</option>
|
||||
<option id="option3c" selected="selected" value="2">2</option>
|
||||
<option id="option3d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select4" id="select4" multiple="multiple">
|
||||
<option id="option4a" selected="selected" value="1">1</option>
|
||||
<option id="option4b" selected="selected" value="2">2</option>
|
||||
<option id="option4c" selected="selected" value="3">3</option>
|
||||
<option id="option4d" selected="selected" value="4">4</option>
|
||||
<option id="option4e" selected="selected" value="5">5</option>
|
||||
</select>
|
||||
<select name="select5" id="select5" multiple="multiple">
|
||||
<option id="option5a" value="0">0</option>
|
||||
<option id="option5b" value="1">1</option>
|
||||
<option id="option5c" value="2">2</option>
|
||||
<option id="option5d" value="3">3</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form id="v2">
|
||||
<input id="v2-i1" name="v2-i1" class="required" />
|
||||
<input id="v2-i2" name="v2-i2" class="required email" />
|
||||
<input id="v2-i3" name="v2-i3" class="url" />
|
||||
<input id="v2-i4" name="v2-i4" class="required" minlength="2" />
|
||||
<input id="v2-i5" name="v2-i5" class="required" minlength="2" maxlength="5" customMethod1="123" />
|
||||
<input id="v2-i6" name="v2-i6" class="required customMethod2 {maxlength: 5}" minlength="2" />
|
||||
<input id="v2-i7" name="v2-i7" />
|
||||
</form>
|
||||
|
||||
<form id="checkables">
|
||||
<input type="checkbox" id="checkable1" name="checkablesgroup" class="required" />
|
||||
<input type="checkbox" id="checkable2" name="checkablesgroup" />
|
||||
<input type="checkbox" id="checkable3" name="checkablesgroup" />
|
||||
</form>
|
||||
|
||||
|
||||
<form id="subformRequired">
|
||||
<div class="billingAddressControl">
|
||||
<input type="checkbox" id="bill_to_co" name="bill_to_co" class="toggleCheck" checked="checked" style="width: auto;" tabindex="1" />
|
||||
<label for="bill_to_co" style="cursor:pointer">Same as Company Address</label>
|
||||
</div>
|
||||
<div id="subform">
|
||||
<input maxlength="40" class="billingRequired" name="bill_first_name" size="20" type="text" tabindex="2" value="" />
|
||||
</div>
|
||||
<input id="co_name" class="required" maxlength="40" name="co_name" size="20" type="text" tabindex="1" value="" />
|
||||
</form>
|
||||
|
||||
<form id="withTitle">
|
||||
<input class="required" name="hastitle" type="text" title="fromtitle" />
|
||||
</form>
|
||||
|
||||
<form id="ccform" method="get" action="">
|
||||
<input id="cardnumber" name="cardnumber" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<ol id="tests"></ol>
|
||||
|
||||
</body>
|
||||
</html>
|
262
www/include/jslibs/jquery-validation/test/index.html
Normal file
262
www/include/jslibs/jquery-validation/test/index.html
Normal file
@@ -0,0 +1,262 @@
|
||||
<!DOCTYPE html>
|
||||
<html id="html">
|
||||
<head>
|
||||
<title>jQuery - Validation Test Suite</title>
|
||||
<link rel="Stylesheet" media="screen" href="qunit/qunit.css" />
|
||||
<script type="text/javascript" src="../lib/jquery.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="qunit/qunit.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.metadata.js"></script>
|
||||
<script type="text/javascript" src="../jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="../additional-methods.js"></script>
|
||||
<script type="text/javascript" src="test.js"></script>
|
||||
<script type="text/javascript" src="rules.js"></script>
|
||||
<script type="text/javascript" src="messages.js"></script>
|
||||
<script type="text/javascript" src="methods.js"></script>
|
||||
</head>
|
||||
<body id="body">
|
||||
<h1 id="qunit-header"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup</div>
|
||||
|
||||
<!-- Test HTML -->
|
||||
<div id="other" style="display:none;">
|
||||
<input type="password" name="pw1" id="pw1" value="engfeh" />
|
||||
<input type="password" name="pw2" id="pw2" value="" />
|
||||
</div>
|
||||
<div id="main" style="position: absolute; top: -10000px; left: -10000px;">
|
||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/">Google Groups</a>.
|
||||
This link has <code><a href="#" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
<div id="foo">
|
||||
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
|
||||
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
|
||||
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
|
||||
|
||||
</div>
|
||||
<p id="first">Try them out:</p>
|
||||
<ul id="firstUL"></ul>
|
||||
<ol id="empty"></ol>
|
||||
|
||||
<form id="testForm1">
|
||||
<input class="{required:true,minlength:2}" title="buga" name="firstname" id="firstname" />
|
||||
<label id="errorFirstname" for="firstname" class="error">error for firstname</label>
|
||||
<input class="{required:true}" title="buga" name="lastname" id="lastname" />
|
||||
<input class="{required:true}" title="something" name="something" id="something" value="something" />
|
||||
</form>
|
||||
|
||||
<form id="testForm1clean">
|
||||
<input title="buga" name="firstname" id="firstnamec" />
|
||||
<label id="errorFirstname" for="firstname" class="error">error for firstname</label>
|
||||
<input title="buga" name="lastname" id="lastnamec" />
|
||||
<input name="username" id="usernamec" />
|
||||
</form>
|
||||
|
||||
<form id="userForm">
|
||||
<input class="{required:true}" name="username" id="username" />
|
||||
<input type="submit" name="submitButton" value="submitButtonValue" />
|
||||
</form>
|
||||
|
||||
<form method="post" id="signupForm" action="../demo/form.php">
|
||||
<input id="user" name="user" title="Please enter your username (at least 3 characters)" class="{required:true,minlength:3}" />
|
||||
<input type="password" name="password" id="password" class="{required:true,minlength:5}" />
|
||||
</form>
|
||||
|
||||
<form id="testForm2">
|
||||
<input class="{required:true}" type="radio" name="agree" id="agb" />
|
||||
<label for="agree" id="agreeLabel" class="xerror">error for agb</label>
|
||||
</form>
|
||||
|
||||
<form id="testForm3">
|
||||
<select class="{required:true}" name="meal" id="meal" >
|
||||
<option value="">Please select...</option>
|
||||
<option value="1">Food</option>
|
||||
<option value="2">Milk</option>
|
||||
</select>
|
||||
</form>
|
||||
<div class="error" id="errorContainer">
|
||||
<ul>
|
||||
<li class="error" id="errorWrapper">
|
||||
<label for="meal" id="mealLabel" class="error">error for meal</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form id="testForm4">
|
||||
<input class="{foo:true}" name="f1" id="f1" />
|
||||
<input class="{bar:true}" name="f2" id="f2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm5">
|
||||
<input class="{equalTo:'#x2'}" value="x" name="x1" id="x1" />
|
||||
<input class="{equalTo:'#x1'}" value="y" name="x2" id="x2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm6">
|
||||
<input class="{required:true,minlength:2}" type="checkbox" name="check" id="form6check1" />
|
||||
<input type="checkbox" name="check" id="form6check2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm7">
|
||||
<select class="{required:true,minlength:2}" name="selectf7" id="selectf7" multiple="multiple">
|
||||
<option id="optionxa" value="0">0</option>
|
||||
<option id="optionxb" value="1">1</option>
|
||||
<option id="optionxc" value="2">2</option>
|
||||
<option id="optionxd" value="3">3</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form id="dateRangeForm">
|
||||
<input id="fromDate" name="fromDate" class="requiredDateRange" value="x" />
|
||||
<input id="toDate" name="toDate" class="requiredDateRange" value="y" />
|
||||
<span class="errorContainer"></span>
|
||||
</form>
|
||||
|
||||
<form id="testForm8">
|
||||
<input id="form8input" class="{required:true,number:true,rangelength:[2,8]}" name="abc" />
|
||||
<input type="radio" name="radio1"/>
|
||||
</form>
|
||||
|
||||
<form id="testForm9">
|
||||
<input id="testEmail9" class="{required:true,email:true,messages:{required:'required',email:'email'}}" />
|
||||
</form>
|
||||
|
||||
<div id="simplecontainer">
|
||||
<h3></h3>
|
||||
</div>
|
||||
|
||||
<div id="container"></div>
|
||||
|
||||
<ol id="labelcontainer"></ol>
|
||||
|
||||
<form id="elementsOrder">
|
||||
<select class="required" name="order1" id="order1"><option value="">none</option></select>
|
||||
<input class="required" name="order2" id="order2"/>
|
||||
<input class="required" name="order3" type="checkbox" id="order3"/>
|
||||
<input class="required" name="order4" id="order4"/>
|
||||
<input class="required" name="order5" type="radio" id="order5"/>
|
||||
<input class="required" name="order6" id="order6"/>
|
||||
<ul id="orderContainer">
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
<form id="form" action="formaction">
|
||||
<input type="text" name="action" value="Test" id="text1"/>
|
||||
<input type="text" name="text2" value=" " id="text1b"/>
|
||||
<input type="text" name="text2" value="T " id="text1c"/>
|
||||
<input type="text" name="text2" value="T" id="text2"/>
|
||||
<input type="text" name="text2" value="TestTestTest" id="text3"/>
|
||||
|
||||
<input type="text" name="action" value="0" id="value1"/>
|
||||
<input type="text" name="text2" value="10" id="value2"/>
|
||||
<input type="text" name="text2" value="1000" id="value3"/>
|
||||
|
||||
<input type="radio" name="radio1" id="radio1"/>
|
||||
<input type="radio" name="radio1" id="radio1a"/>
|
||||
<input type="radio" name="radio2" id="radio2" checked="checked"/>
|
||||
<input type="radio" name="radio" id="radio3"/>
|
||||
<input type="radio" name="radio" id="radio4" checked="checked"/>
|
||||
|
||||
<input type="checkbox" name="check" id="check1" checked="checked"/>
|
||||
<input type="checkbox" name="check" id="check1b" />
|
||||
|
||||
<input type="checkbox" name="check2" id="check2"/>
|
||||
|
||||
<input type="checkbox" name="check3" id="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
|
||||
<input type="hidden" name="hidden" id="hidden1"/>
|
||||
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
|
||||
|
||||
<input type="text" readonly="readonly" id="name" name="name" value="name" />
|
||||
|
||||
<button name="button">Button</button>
|
||||
|
||||
<textarea id="area1" name="area1"">foobar</textarea>
|
||||
|
||||
|
||||
<textarea id="area2" name="area2"></textarea>
|
||||
|
||||
<select name="select1" id="select1">
|
||||
<option id="option1a" value="">Nothing</option>
|
||||
<option id="option1b" value="1">1</option>
|
||||
<option id="option1c" value="2">2</option>
|
||||
<option id="option1d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select2" id="select2">
|
||||
<option id="option2a" value="">Nothing</option>
|
||||
<option id="option2b" value="1">1</option>
|
||||
<option id="option2c" value="2">2</option>
|
||||
<option id="option2d" selected="selected" value="3">3</option>
|
||||
</select>
|
||||
<select name="select3" id="select3" multiple="multiple">
|
||||
<option id="option3a" value="">Nothing</option>
|
||||
<option id="option3b" selected="selected" value="1">1</option>
|
||||
<option id="option3c" selected="selected" value="2">2</option>
|
||||
<option id="option3d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select4" id="select4" multiple="multiple">
|
||||
<option id="option4a" selected="selected" value="1">1</option>
|
||||
<option id="option4b" selected="selected" value="2">2</option>
|
||||
<option id="option4c" selected="selected" value="3">3</option>
|
||||
<option id="option4d" selected="selected" value="4">4</option>
|
||||
<option id="option4e" selected="selected" value="5">5</option>
|
||||
</select>
|
||||
<select name="select5" id="select5" multiple="multiple">
|
||||
<option id="option5a" value="0">0</option>
|
||||
<option id="option5b" value="1">1</option>
|
||||
<option id="option5c" value="2">2</option>
|
||||
<option id="option5d" value="3">3</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form id="v2">
|
||||
<input id="v2-i1" name="v2-i1" class="required" />
|
||||
<input id="v2-i2" name="v2-i2" class="required email" />
|
||||
<input id="v2-i3" name="v2-i3" class="url" />
|
||||
<input id="v2-i4" name="v2-i4" class="required" minlength="2" />
|
||||
<input id="v2-i5" name="v2-i5" class="required" minlength="2" maxlength="5" customMethod1="123" />
|
||||
<input id="v2-i6" name="v2-i6" class="required customMethod2 {maxlength: 5}" minlength="2" />
|
||||
<input id="v2-i7" name="v2-i7" />
|
||||
</form>
|
||||
|
||||
<form id="checkables">
|
||||
<input type="checkbox" id="checkable1" name="checkablesgroup" class="required" />
|
||||
<input type="checkbox" id="checkable2" name="checkablesgroup" />
|
||||
<input type="checkbox" id="checkable3" name="checkablesgroup" />
|
||||
</form>
|
||||
|
||||
|
||||
<form id="subformRequired">
|
||||
<div class="billingAddressControl">
|
||||
<input type="checkbox" id="bill_to_co" name="bill_to_co" class="toggleCheck" checked="checked" style="width: auto;" tabindex="1" />
|
||||
<label for="bill_to_co" style="cursor:pointer">Same as Company Address</label>
|
||||
</div>
|
||||
<div id="subform">
|
||||
<input maxlength="40" class="billingRequired" name="bill_first_name" size="20" type="text" tabindex="2" value="" />
|
||||
</div>
|
||||
<input id="co_name" class="required" maxlength="40" name="co_name" size="20" type="text" tabindex="1" value="" />
|
||||
</form>
|
||||
|
||||
<form id="withTitle">
|
||||
<input class="required" name="hastitle" type="text" title="fromtitle" />
|
||||
</form>
|
||||
|
||||
<form id="ccform" method="get" action="">
|
||||
<input id="cardnumber" name="cardnumber" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
188
www/include/jslibs/jquery-validation/test/large.html
Normal file
188
www/include/jslibs/jquery-validation/test/large.html
Normal file
@@ -0,0 +1,188 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.ajaxQueue.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
$("#commentForm").validate();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#commentForm { width: 500px; }
|
||||
#commentForm label { width: 250px; display: block; float: left; }
|
||||
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
|
||||
.focus { background-color: red; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname-x0">Name (required, at least 2 characters)</label>
|
||||
<input id="cname-x0" name="name-x0" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail-x0">E-Mail (required)</label>
|
||||
<input id="cemail-x0" name="email-x0" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x0">URL (optional)</label>
|
||||
<input id="curl-x0" name="url-x0" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x0">Your comment (required)</label>
|
||||
<textarea id="ccomment-x0" name="comment-x0" class="{required:true}"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x1">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x1" id="cname-x1"/>
|
||||
</p><p>
|
||||
<label for="cemail-x1">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x1" id="cemail-x1"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x1">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x1" id="curl-x1"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x1">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x1" id="ccomment-x1"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x2">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x2" id="cname-x2"/>
|
||||
</p><p>
|
||||
<label for="cemail-x2">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x2" id="cemail-x2"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x2">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x2" id="curl-x2"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x2">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x2" id="ccomment-x2"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x3">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x3" id="cname-x3"/>
|
||||
</p><p>
|
||||
<label for="cemail-x3">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x3" id="cemail-x3"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x3">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x3" id="curl-x3"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x3">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x3" id="ccomment-x3"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x4">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x4" id="cname-x4"/>
|
||||
</p><p>
|
||||
<label for="cemail-x4">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x4" id="cemail-x4"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x4">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x4" id="curl-x4"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x4">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x4" id="ccomment-x4"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x5">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x5" id="cname-x5"/>
|
||||
</p><p>
|
||||
<label for="cemail-x5">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x5" id="cemail-x5"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x5">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x5" id="curl-x5"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x5">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x5" id="ccomment-x5"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x6">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x6" id="cname-x6"/>
|
||||
</p><p>
|
||||
<label for="cemail-x6">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x6" id="cemail-x6"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x6">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x6" id="curl-x6"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x6">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x6" id="ccomment-x6"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x7">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x7" id="cname-x7"/>
|
||||
</p><p>
|
||||
<label for="cemail-x7">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x7" id="cemail-x7"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x7">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x7" id="curl-x7"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x7">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x7" id="ccomment-x7"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x8">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x8" id="cname-x8"/>
|
||||
</p><p>
|
||||
<label for="cemail-x8">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x8" id="cemail-x8"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x8">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x8" id="curl-x8"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x8">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x8" id="ccomment-x8"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x9">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x9" id="cname-x9"/>
|
||||
</p><p>
|
||||
<label for="cemail-x9">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x9" id="cemail-x9"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x9">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x9" id="curl-x9"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x9">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x9" id="ccomment-x9"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
62
www/include/jslibs/jquery-validation/test/messages.js
vendored
Normal file
62
www/include/jslibs/jquery-validation/test/messages.js
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
module("messages");
|
||||
|
||||
test("predefined message not overwritten by addMethod(a, b, undefined)", function() {
|
||||
var message = "my custom message";
|
||||
$.validator.messages.custom = message;
|
||||
$.validator.addMethod("custom", function() {});
|
||||
same(message, $.validator.messages.custom);
|
||||
delete $.validator.messages.custom;
|
||||
delete $.validator.methods.custom;
|
||||
});
|
||||
|
||||
test("group error messages", function() {
|
||||
$.validator.addClassRules({
|
||||
requiredDateRange: {required:true, date:true, dateRange:true}
|
||||
});
|
||||
$.validator.addMethod("dateRange", function() {
|
||||
return new Date($("#fromDate").val()) < new Date($("#toDate").val());
|
||||
}, "Please specify a correct date range.");
|
||||
var form = $("#dateRangeForm");
|
||||
form.validate({
|
||||
groups: {
|
||||
dateRange: "fromDate toDate"
|
||||
},
|
||||
errorPlacement: function(error) {
|
||||
form.find(".errorContainer").append(error);
|
||||
}
|
||||
});
|
||||
ok( !form.valid() );
|
||||
equals( 1, form.find(".errorContainer *").length );
|
||||
equals( "Please enter a valid date.", form.find(".errorContainer label.error").text() );
|
||||
|
||||
$("#fromDate").val("12/03/2006");
|
||||
$("#toDate").val("12/01/2006");
|
||||
ok( !form.valid() );
|
||||
equals( "Please specify a correct date range.", form.find(".errorContainer label.error").text() );
|
||||
|
||||
$("#toDate").val("12/04/2006");
|
||||
ok( form.valid() );
|
||||
ok( form.find(".errorContainer label.error").is(":hidden") );
|
||||
});
|
||||
|
||||
test("read messages from metadata", function() {
|
||||
var form = $("#testForm9")
|
||||
form.validate();
|
||||
var e = $("#testEmail9")
|
||||
e.valid();
|
||||
equals( form.find("label").text(), "required" );
|
||||
e.val("bla").valid();
|
||||
equals( form.find("label").text(), "email" );
|
||||
});
|
||||
|
||||
|
||||
test("read messages from metadata, with meta option specified, but no metadata in there", function() {
|
||||
var form = $("#testForm1clean")
|
||||
form.validate({
|
||||
meta: "validate",
|
||||
rules: {
|
||||
firstname: "required"
|
||||
}
|
||||
});
|
||||
ok(!form.valid(), "not valid");
|
||||
});
|
584
www/include/jslibs/jquery-validation/test/methods.js
vendored
Normal file
584
www/include/jslibs/jquery-validation/test/methods.js
vendored
Normal file
@@ -0,0 +1,584 @@
|
||||
(function($) {
|
||||
|
||||
function methodTest( methodName ) {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods[methodName];
|
||||
var element = $("#firstname")[0];
|
||||
return function(value, param) {
|
||||
element.value = value;
|
||||
return method.call( v, value, element, param );
|
||||
};
|
||||
}
|
||||
|
||||
module("methods");
|
||||
|
||||
test("default messages", function() {
|
||||
var m = $.validator.methods;
|
||||
$.each(m, function(key) {
|
||||
ok( jQuery.validator.messages[key], key + " has a default message." );
|
||||
});
|
||||
});
|
||||
|
||||
test("digit", function() {
|
||||
var method = methodTest("digits");
|
||||
ok( method( "123" ), "Valid digits" );
|
||||
ok(!method( "123.000" ), "Invalid digits" );
|
||||
ok(!method( "123.000,00" ), "Invalid digits" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid digits" );
|
||||
ok(!method( "x123" ), "Invalid digits" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid digits" );
|
||||
});
|
||||
|
||||
test("url", function() {
|
||||
var method = methodTest("url");
|
||||
ok( method( "http://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "https://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "ftp://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "http://www.føtex.dk/" ), "Valid url, danish unicode characters" );
|
||||
ok( method( "http://bösendorfer.de/" ), "Valid url, german unicode characters" );
|
||||
ok( method( "http://192.168.8.5" ), "Valid IP Address" )
|
||||
ok(!method( "http://192.168.8." ), "Invalid IP Address" )
|
||||
ok(!method( "http://bassistance" ), "Invalid url" ); // valid
|
||||
ok(!method( "http://bassistance." ), "Invalid url" ); // valid
|
||||
ok(!method( "http://bassistance,de" ), "Invalid url" );
|
||||
ok(!method( "http://bassistance;de" ), "Invalid url" );
|
||||
ok(!method( "http://.bassistancede" ), "Invalid url" );
|
||||
ok(!method( "bassistance.de" ), "Invalid url" );
|
||||
});
|
||||
|
||||
test("url2 (tld optional)", function() {
|
||||
var method = methodTest("url2");
|
||||
ok( method( "http://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "https://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "ftp://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "http://www.føtex.dk/" ), "Valid url, danish unicode characters" );
|
||||
ok( method( "http://bösendorfer.de/" ), "Valid url, german unicode characters" );
|
||||
ok( method( "http://192.168.8.5" ), "Valid IP Address" )
|
||||
ok(!method( "http://192.168.8." ), "Invalid IP Address" )
|
||||
ok( method( "http://bassistance" ), "Invalid url" );
|
||||
ok( method( "http://bassistance." ), "Invalid url" );
|
||||
ok(!method( "http://bassistance,de" ), "Invalid url" );
|
||||
ok(!method( "http://bassistance;de" ), "Invalid url" );
|
||||
ok(!method( "http://.bassistancede" ), "Invalid url" );
|
||||
ok(!method( "bassistance.de" ), "Invalid url" );
|
||||
});
|
||||
|
||||
test("email", function() {
|
||||
var method = methodTest("email");
|
||||
ok( method( "name@domain.tld" ), "Valid email" );
|
||||
ok( method( "name@domain.tl" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.com" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.travel" ), "Valid email" );
|
||||
ok( method( "n@d.tld" ), "Valid email" );
|
||||
ok( method( "ole@føtex.dk"), "Valid email" );
|
||||
ok( method( "jörn@bassistance.de"), "Valid email" );
|
||||
ok( method( "bla.blu@g.mail.com"), "Valid email" );
|
||||
ok( method( "\"Scott Gonzalez\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"Scott González\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"name.\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name,\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name;\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok(!method( "name" ), "Invalid email" );
|
||||
ok(!method( "name@" ), "Invalid email" );
|
||||
ok(!method( "name@domain" ), "Invalid email" );
|
||||
ok(!method( "name.@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name,@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name;@domain.tld" ), "Invalid email" );
|
||||
});
|
||||
|
||||
test("email2 (tld optional)", function() {
|
||||
var method = methodTest("email2");
|
||||
ok( method( "name@domain.tld" ), "Valid email" );
|
||||
ok( method( "name@domain.tl" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.com" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.travel" ), "Valid email" );
|
||||
ok( method( "n@d.tld" ), "Valid email" );
|
||||
ok( method( "ole@føtex.dk"), "Valid email" );
|
||||
ok( method( "jörn@bassistance.de"), "Valid email" );
|
||||
ok( method( "bla.blu@g.mail.com"), "Valid email" );
|
||||
ok( method( "\"Scott Gonzalez\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"Scott González\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"name.\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name,\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name;\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok(!method( "name" ), "Invalid email" );
|
||||
ok(!method( "name@" ), "Invalid email" );
|
||||
ok( method( "name@domain" ), "Invalid email" );
|
||||
ok(!method( "name.@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name,@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name;@domain.tld" ), "Invalid email" );
|
||||
});
|
||||
|
||||
test("number", function() {
|
||||
var method = methodTest("number");
|
||||
ok( method( "123" ), "Valid number" );
|
||||
ok( method( "-123" ), "Valid number" );
|
||||
ok( method( "123,000" ), "Valid number" );
|
||||
ok( method( "-123,000" ), "Valid number" );
|
||||
ok( method( "123,000.00" ), "Valid number" );
|
||||
ok( method( "-123,000.00" ), "Valid number" );
|
||||
ok(!method( "123.000,00" ), "Invalid number" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid number" );
|
||||
ok(!method( "x123" ), "Invalid number" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid number" );
|
||||
|
||||
ok( method( "" ), "Blank is valid" );
|
||||
ok( method( "123" ), "Valid decimal" );
|
||||
ok( method( "123000" ), "Valid decimal" );
|
||||
ok( method( "123000.12" ), "Valid decimal" );
|
||||
ok( method( "-123000.12" ), "Valid decimal" );
|
||||
ok( method( "123.000" ), "Valid decimal" );
|
||||
ok( method( "123,000.00" ), "Valid decimal" );
|
||||
ok( method( "-123,000.00" ), "Valid decimal" );
|
||||
ok(!method( "1230,000.00" ), "Invalid decimal" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid decimal" );
|
||||
ok(!method( "x123" ), "Invalid decimal" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid decimal" );
|
||||
});
|
||||
|
||||
/* disabled for now, need to figure out how to test localized methods
|
||||
test("numberDE", function() {
|
||||
var method = methodTest("numberDE");
|
||||
ok( method( "123" ), "Valid numberDE" );
|
||||
ok( method( "-123" ), "Valid numberDE" );
|
||||
ok( method( "123.000" ), "Valid numberDE" );
|
||||
ok( method( "-123.000" ), "Valid numberDE" );
|
||||
ok( method( "123.000,00" ), "Valid numberDE" );
|
||||
ok( method( "-123.000,00" ), "Valid numberDE" );
|
||||
ok(!method( "123,000.00" ), "Invalid numberDE" );
|
||||
ok(!method( "123,0,0.0" ), "Invalid numberDE" );
|
||||
ok(!method( "x123" ), "Invalid numberDE" );
|
||||
ok(!method( "100,100.0.0" ), "Invalid numberDE" );
|
||||
|
||||
ok( method( "" ), "Blank is valid" );
|
||||
ok( method( "123" ), "Valid decimalDE" );
|
||||
ok( method( "123000" ), "Valid decimalDE" );
|
||||
ok( method( "123000,12" ), "Valid decimalDE" );
|
||||
ok( method( "-123000,12" ), "Valid decimalDE" );
|
||||
ok( method( "123.000" ), "Valid decimalDE" );
|
||||
ok( method( "123.000,00" ), "Valid decimalDE" );
|
||||
ok( method( "-123.000,00" ), "Valid decimalDE" )
|
||||
ok(!method( "123.0.0,0" ), "Invalid decimalDE" );
|
||||
ok(!method( "x123" ), "Invalid decimalDE" );
|
||||
ok(!method( "100,100.0.0" ), "Invalid decimalDE" );
|
||||
});
|
||||
*/
|
||||
|
||||
test("date", function() {
|
||||
var method = methodTest("date");
|
||||
ok( method( "06/06/1990" ), "Valid date" );
|
||||
ok( method( "6/6/06" ), "Valid date" );
|
||||
ok(!method( "1990x-06-06" ), "Invalid date" );
|
||||
});
|
||||
|
||||
test("dateISO", function() {
|
||||
var method = methodTest("dateISO");
|
||||
ok( method( "1990-06-06" ), "Valid date" );
|
||||
ok( method( "1990/06/06" ), "Valid date" );
|
||||
ok( method( "1990-6-6" ), "Valid date" );
|
||||
ok( method( "1990/6/6" ), "Valid date" );
|
||||
ok(!method( "1990-106-06" ), "Invalid date" );
|
||||
ok(!method( "190-06-06" ), "Invalid date" );
|
||||
});
|
||||
|
||||
/* disabled for now, need to figure out how to test localized methods
|
||||
test("dateDE", function() {
|
||||
var method = methodTest("dateDE");
|
||||
ok( method( "03.06.1984" ), "Valid dateDE" );
|
||||
ok( method( "3.6.84" ), "Valid dateDE" );
|
||||
ok(!method( "6-6-06" ), "Invalid dateDE" );
|
||||
ok(!method( "1990-06-06" ), "Invalid dateDE" );
|
||||
ok(!method( "06/06/1990" ), "Invalid dateDE" );
|
||||
ok(!method( "6/6/06" ), "Invalid dateDE" );
|
||||
});
|
||||
*/
|
||||
|
||||
test("required", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.required,
|
||||
e = $('#text1, #text1b, #hidden2, #select1, #select2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid text input" );
|
||||
ok(!method.call( v, e[1].value, e[2]), "Invalid text input" );
|
||||
|
||||
ok(!method.call( v, e[2].value, e[3]), "Invalid select" );
|
||||
ok( method.call( v, e[3].value, e[4]), "Valid select" );
|
||||
|
||||
e = $('#area1, #area2, #pw1, #pw2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid textarea" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid textarea" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid password input" );
|
||||
ok(!method.call( v, e[3].value, e[3]), "Invalid password input" );
|
||||
|
||||
e = $('#radio1, #radio2, #radio3');
|
||||
ok(!method.call( v, e[0].value, e[0]), "Invalid radio" );
|
||||
ok( method.call( v, e[1].value, e[1]), "Valid radio" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid radio" );
|
||||
|
||||
e = $('#check1, #check2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid checkbox" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4');
|
||||
ok(!method.call( v, e[0].value, e[0]), "Invalid select" );
|
||||
ok( method.call( v, e[1].value, e[1]), "Valid select" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid select" );
|
||||
ok( method.call( v, e[3].value, e[3]), "Valid select" );
|
||||
});
|
||||
|
||||
test("required with dependencies", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.required,
|
||||
e = $('#hidden2, #select1, #area2, #radio1, #check2');
|
||||
ok( method.call( v, e[0].value, e[0], "asffsaa"), "Valid text input due to depencie not met" );
|
||||
ok(!method.call( v, e[0].value, e[0], "input"), "Invalid text input" );
|
||||
ok( method.call( v, e[0].value, e[0], function() { return false; }), "Valid text input due to depencie not met" );
|
||||
ok(!method.call( v, e[0].value, e[0], function() { return true; }), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], "asfsfa"), "Valid select due to dependency not met" );
|
||||
ok(!method.call( v, e[1].value, e[1], "input"), "Invalid select" );
|
||||
ok( method.call( v, e[2].value, e[2], "asfsafsfa"), "Valid textarea due to dependency not met" );
|
||||
ok(!method.call( v, e[2].value, e[2], "input"), "Invalid textarea" );
|
||||
ok( method.call( v, e[3].value, e[3], "asfsafsfa"), "Valid radio due to dependency not met" );
|
||||
ok(!method.call( v, e[3].value, e[3], "input"), "Invalid radio" );
|
||||
ok( method.call( v, e[4].value, e[4], "asfsafsfa"), "Valid checkbox due to dependency not met" );
|
||||
ok(!method.call( v, e[4].value, e[4], "input"), "Invalid checkbox" );
|
||||
});
|
||||
|
||||
test("minlength", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.minlength,
|
||||
param = 2,
|
||||
e = $('#text1, #text1c, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
ok( method.call( v, e[3].value, e[3], param), "Valid text input" );
|
||||
|
||||
e = $('#check1, #check2, #check3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4, #select5');
|
||||
ok(method.call( v, e[0].value, e[0], param), "Valid select " + e[0].id );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid select " + e[1].id );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid select " + e[2].id );
|
||||
ok( method.call( v, e[3].value, e[3], param), "Valid select " + e[3].id );
|
||||
ok( method.call( v, e[4].value, e[4], param), "Valid select " + e[4].id );
|
||||
});
|
||||
|
||||
test("maxlength", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.maxlength,
|
||||
param = 4,
|
||||
e = $('#text1, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
|
||||
e = $('#check1, #check2, #check3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Invalid checkbox" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid select" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid select" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid select" );
|
||||
ok(!method.call( v, e[3].value, e[3], param), "Invalid select" );
|
||||
});
|
||||
|
||||
test("rangelength", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.rangelength,
|
||||
param = [2, 4],
|
||||
e = $('#text1, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("min", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.min,
|
||||
param = 8,
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid text input" );
|
||||
});
|
||||
|
||||
test("max", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.max,
|
||||
param = 12,
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("range", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.range,
|
||||
param = [4,12],
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("equalTo", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.equalTo,
|
||||
e = $('#text1, #text2');
|
||||
ok( method.call( v, "Test", e[0], "#text1"), "Text input" );
|
||||
ok( method.call( v, "T", e[1], "#text2"), "Another one" );
|
||||
});
|
||||
|
||||
test("creditcard", function() {
|
||||
var method = methodTest("creditcard");
|
||||
ok( method( "446-667-651" ), "Valid creditcard number" );
|
||||
ok( !method( "asdf" ), "Invalid creditcard number" );
|
||||
});
|
||||
|
||||
test("accept", function() {
|
||||
var method = methodTest("accept");
|
||||
ok( method( "picture.gif" ), "Valid default accept type" );
|
||||
ok( method( "picture.jpg" ), "Valid default accept type" );
|
||||
ok( method( "picture.jpeg" ), "Valid default accept type" );
|
||||
ok( method( "picture.png" ), "Valid default accept type" );
|
||||
ok( !method( "picture.pgn" ), "Invalid default accept type" );
|
||||
|
||||
var v = jQuery("#form").validate(),
|
||||
method = function(value, param) {
|
||||
return $.validator.methods.accept.call(v, value, $('#text1')[0], param)
|
||||
};
|
||||
ok( method( "picture.doc", "doc"), "Valid custom accept type" );
|
||||
ok( method( "picture.pdf", "doc|pdf"), "Valid custom accept type" );
|
||||
ok( method( "picture.pdf", "pdf|doc"), "Valid custom accept type" );
|
||||
ok( !method( "picture.pdf", "doc"), "Invalid custom accept type" );
|
||||
ok( !method( "picture.doc", "pdf"), "Invalid custom accept type" );
|
||||
|
||||
ok( method( "picture.pdf", "doc,pdf"), "Valid custom accept type, comma seperated" );
|
||||
ok( method( "picture.pdf", "pdf,doc"), "Valid custom accept type, comma seperated" );
|
||||
ok( !method( "picture.pdf", "gop,top"), "Invalid custom accept type, comma seperated" );
|
||||
});
|
||||
|
||||
test("remote", function() {
|
||||
expect(7);
|
||||
stop();
|
||||
var e = $("#username");
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: "users.php"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
username: {
|
||||
required: "Please",
|
||||
remote: jQuery.validator.format("{0} in use")
|
||||
}
|
||||
},
|
||||
submitHandler: function() {
|
||||
ok( false, "submitHandler may never be called when validating only elements");
|
||||
}
|
||||
});
|
||||
$(document).ajaxStop(function() {
|
||||
$(document).unbind("ajaxStop");
|
||||
equals( 1, v.size(), "There must be one error" );
|
||||
equals( "Peter in use", v.errorList[0].message );
|
||||
|
||||
$(document).ajaxStop(function() {
|
||||
$(document).unbind("ajaxStop");
|
||||
equals( 1, v.size(), "There must be one error" );
|
||||
equals( "Peter2 in use", v.errorList[0].message );
|
||||
start();
|
||||
});
|
||||
e.val("Peter2");
|
||||
ok( !v.element(e), "new value, new request" );
|
||||
});
|
||||
ok( !v.element(e), "invalid element, nothing entered yet" );
|
||||
e.val("Peter");
|
||||
ok( !v.element(e), "still invalid, because remote validation must block until it returns" );
|
||||
});
|
||||
|
||||
test("remote, customized ajax options", function() {
|
||||
expect(2);
|
||||
stop();
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: {
|
||||
url: "users.php",
|
||||
type: "post",
|
||||
beforeSend: function(request, settings) {
|
||||
same(settings.type, "post");
|
||||
same(settings.data, "username=asdf&email=email.com");
|
||||
},
|
||||
data: {
|
||||
email: function() {
|
||||
return "email.com";
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#username").val("asdf");
|
||||
$("#userForm").valid();
|
||||
});
|
||||
|
||||
|
||||
test("remote extensions", function() {
|
||||
expect(5);
|
||||
stop();
|
||||
var e = $("#username");
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: "users2.php"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
username: {
|
||||
required: "Please"
|
||||
}
|
||||
},
|
||||
submitHandler: function() {
|
||||
ok( false, "submitHandler may never be called when validating only elements");
|
||||
}
|
||||
});
|
||||
$(document).ajaxStop(function() {
|
||||
$(document).unbind("ajaxStop");
|
||||
equals( 1, v.size(), "There must be one error" );
|
||||
equals( v.errorList[0].message, "asdf is already taken, please try something else" );
|
||||
v.element(e);
|
||||
equals( v.errorList[0].message, "asdf is already taken, please try something else", "message doesn't change on revalidation" );
|
||||
start();
|
||||
});
|
||||
ok( !v.element(e), "invalid element, nothing entered yet" );
|
||||
e.val("asdf");
|
||||
ok( !v.element(e), "still invalid, because remote validation must block until it returns" );
|
||||
});
|
||||
|
||||
module("additional methods");
|
||||
|
||||
test("phone (us)", function() {
|
||||
var method = methodTest("phoneUS");
|
||||
ok( method( "1(212)-999-2345" ), "Valid us phone number" );
|
||||
ok( method( "212 999 2344" ), "Valid us phone number" );
|
||||
ok( method( "212-999-0983" ), "Valid us phone number" );
|
||||
ok(!method( "111-123-5434" ), "Invalid us phone number" );
|
||||
ok(!method( "212 123 4567" ), "Invalid us phone number" );
|
||||
});
|
||||
|
||||
test("dateITA", function() {
|
||||
var method = methodTest("dateITA");
|
||||
ok( method( "01/01/1900" ), "Valid date ITA" );
|
||||
ok(!method( "01/13/1990" ), "Invalid date ITA" );
|
||||
ok(!method( "01.01.1900" ), "Invalid date ITA" );
|
||||
});
|
||||
|
||||
test("time", function() {
|
||||
var method = methodTest("time");
|
||||
ok( method("00:00"), "Valid time, lower bound" );
|
||||
ok( method("23:59"), "Valid time, upper bound" );
|
||||
ok( !method("24:60"), "Invalid time" );
|
||||
ok( !method("24:00"), "Invalid time" );
|
||||
ok( !method("29:59"), "Invalid time" );
|
||||
ok( !method("30:00"), "Invalid time" );
|
||||
});
|
||||
|
||||
test("minWords", function() {
|
||||
var method = methodTest("minWords");
|
||||
ok( method("hello worlds", 2), "plain text, valid" );
|
||||
ok( method("<b>hello</b> world", 2), "html, valid" );
|
||||
ok( !method("hello", 2), "plain text, invalid" );
|
||||
ok( !method("<b>world</b>", 2), "html, invalid" );
|
||||
ok( !method("world <br/>", 2), "html, invalid" );
|
||||
});
|
||||
|
||||
test("maxWords", function() {
|
||||
var method = methodTest("maxWords");
|
||||
ok( method("hello", 2), "plain text, valid" );
|
||||
ok( method("<b>world</b>", 2), "html, valid" );
|
||||
ok( method("world <br/>", 2), "html, valid" );
|
||||
ok( !method("hello worlds", 2), "plain text, invalid" );
|
||||
ok( !method("<b>hello</b> world", 2), "html, invalid" );
|
||||
});
|
||||
|
||||
function testCardTypeByNumber(number, cardname, expected) {
|
||||
$("#cardnumber").val(number);
|
||||
var actual = $("#ccform").valid();
|
||||
equals(actual, expected, $.format("Expect card number {0} to validate to {1}, actually validated to ", number, expected));
|
||||
}
|
||||
|
||||
test('creditcardtypes, all', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
all: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber("4111-1111-1111-1111", "VISA", true)
|
||||
testCardTypeByNumber("5111-1111-1111-1118", "MasterCard", true)
|
||||
testCardTypeByNumber("6111-1111-1111-1116", "Discover", true)
|
||||
testCardTypeByNumber("3400-0000-0000-009", "AMEX", true);
|
||||
|
||||
testCardTypeByNumber("4111-1111-1111-1110", "VISA", false)
|
||||
testCardTypeByNumber("5432-1111-1111-1111", "MasterCard", false)
|
||||
testCardTypeByNumber("6611-6611-6611-6611", "Discover", false)
|
||||
testCardTypeByNumber("3777-7777-7777-7777", "AMEX", false)
|
||||
|
||||
});
|
||||
|
||||
test('creditcardtypes, visa', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
visa: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber("4111-1111-1111-1111", "VISA", true)
|
||||
testCardTypeByNumber("5111-1111-1111-1118", "MasterCard", false)
|
||||
testCardTypeByNumber("6111-1111-1111-1116", "Discover", false)
|
||||
testCardTypeByNumber("3400-0000-0000-009", "AMEX", false);
|
||||
});
|
||||
|
||||
test('creditcardtypes, mastercard', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
mastercard: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber("5111-1111-1111-1118", "MasterCard", true)
|
||||
testCardTypeByNumber("6111-1111-1111-1116", "Discover", false)
|
||||
testCardTypeByNumber("3400-0000-0000-009", "AMEX", false);
|
||||
testCardTypeByNumber("4111-1111-1111-1111", "VISA", false);
|
||||
});
|
||||
|
||||
})(jQuery);
|
197
www/include/jslibs/jquery-validation/test/qunit/qunit.css
Normal file
197
www/include/jslibs/jquery-validation/test/qunit/qunit.css
Normal file
@@ -0,0 +1,197 @@
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
||||
#qunit-tests { font-size: smaller; }
|
||||
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #8699a4;
|
||||
background-color: #0d3349;
|
||||
|
||||
font-size: 1.5em;
|
||||
line-height: 1em;
|
||||
font-weight: normal;
|
||||
|
||||
border-radius: 15px 15px 0 0;
|
||||
-moz-border-radius: 15px 15px 0 0;
|
||||
-webkit-border-top-right-radius: 15px;
|
||||
-webkit-border-top-left-radius: 15px;
|
||||
}
|
||||
|
||||
#qunit-header a {
|
||||
text-decoration: none;
|
||||
color: #c2ccd1;
|
||||
}
|
||||
|
||||
#qunit-header a:hover,
|
||||
#qunit-header a:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0.5em 0 0.5em 2em;
|
||||
color: #5E740B;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 0 0.5em 2.5em;
|
||||
background-color: #2b81af;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
||||
border-bottom: 1px solid #fff;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests ol {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #fff;
|
||||
|
||||
border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
|
||||
box-shadow: inset 0px 2px 13px #999;
|
||||
-moz-box-shadow: inset 0px 2px 13px #999;
|
||||
-webkit-box-shadow: inset 0px 2px 13px #999;
|
||||
}
|
||||
|
||||
#qunit-tests table {
|
||||
border-collapse: collapse;
|
||||
margin-top: .2em;
|
||||
}
|
||||
|
||||
#qunit-tests th {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 0 .5em 0 0;
|
||||
}
|
||||
|
||||
#qunit-tests td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#qunit-tests pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#qunit-tests del {
|
||||
background-color: #e0f2be;
|
||||
color: #374e0c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests ins {
|
||||
background-color: #ffcaca;
|
||||
color: #500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*** Test Counts */
|
||||
|
||||
#qunit-tests b.counts { color: black; }
|
||||
#qunit-tests b.passed { color: #5E740B; }
|
||||
#qunit-tests b.failed { color: #710909; }
|
||||
|
||||
#qunit-tests li li {
|
||||
margin: 0.5em;
|
||||
padding: 0.4em 0.5em 0.4em 0.5em;
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #5E740B;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
||||
#qunit-tests .pass .test-name { color: #366097; }
|
||||
|
||||
#qunit-tests .pass .test-actual,
|
||||
#qunit-tests .pass .test-expected { color: #999999; }
|
||||
|
||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #EE5757;
|
||||
}
|
||||
|
||||
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
|
||||
#qunit-tests .fail .test-name,
|
||||
#qunit-tests .fail .module-name { color: #000000; }
|
||||
|
||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
||||
#qunit-tests .fail .test-expected { color: green; }
|
||||
|
||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
||||
|
||||
|
||||
/** Footer */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
||||
|
||||
color: #2b81af;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-radius: 0 0 15px 15px;
|
||||
-moz-border-radius: 0 0 15px 15px;
|
||||
-webkit-border-bottom-right-radius: 15px;
|
||||
-webkit-border-bottom-left-radius: 15px;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
}
|
1414
www/include/jslibs/jquery-validation/test/qunit/qunit.js
vendored
Normal file
1414
www/include/jslibs/jquery-validation/test/qunit/qunit.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
267
www/include/jslibs/jquery-validation/test/rules.js
vendored
Normal file
267
www/include/jslibs/jquery-validation/test/rules.js
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
module("rules");
|
||||
|
||||
test("rules() - internal - input", function() {
|
||||
var element = $('#firstname');
|
||||
var v = $('#testForm1').validate();
|
||||
same( element.rules(), { required: true, minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules(), ignore method:false", function() {
|
||||
var element = $('#firstnamec');
|
||||
var v = $('#testForm1clean').validate({
|
||||
rules: {
|
||||
firstname: { required: false, minlength: 2 }
|
||||
}
|
||||
});
|
||||
same( element.rules(), { minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules() - internal - select", function() {
|
||||
var element = $('#meal');
|
||||
var v = $('#testForm3').validate();
|
||||
same( element.rules(), {required: true} );
|
||||
});
|
||||
|
||||
test("rules() - external", function() {
|
||||
var element = $('#text1');
|
||||
var v = $('#form').validate({
|
||||
rules: {
|
||||
action: {date: true, min: 5}
|
||||
}
|
||||
});
|
||||
same( element.rules(), {date: true, min: 5} );
|
||||
});
|
||||
|
||||
test("rules() - external - complete form", function() {
|
||||
expect(1);
|
||||
|
||||
var methods = $.extend({}, $.validator.methods);
|
||||
var messages = $.extend({}, $.validator.messages);
|
||||
|
||||
$.validator.addMethod("verifyTest", function() {
|
||||
ok( true, "method executed" );
|
||||
return true;
|
||||
});
|
||||
var v = $('#form').validate({
|
||||
rules: {
|
||||
action: {verifyTest: true}
|
||||
}
|
||||
});
|
||||
v.form();
|
||||
|
||||
$.validator.methods = methods;
|
||||
$.validator.messages = messages;
|
||||
});
|
||||
|
||||
test("rules() - internal - input", function() {
|
||||
var element = $('#form8input');
|
||||
var v = $('#testForm8').validate();
|
||||
same( element.rules(), {required: true, number: true, rangelength: [2, 8]});
|
||||
});
|
||||
|
||||
test("rules(), merge min/max to range, minlength/maxlength to rangelength", function() {
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: 5,
|
||||
max: 12
|
||||
},
|
||||
lastname: {
|
||||
minlength: 2,
|
||||
maxlength: 8
|
||||
}
|
||||
}
|
||||
});
|
||||
same( $("#firstnamec").rules(), {range: [5, 12]});
|
||||
|
||||
same( $("#lastnamec").rules(), {rangelength: [2, 8]} );
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
});
|
||||
|
||||
test("rules(), gurantee that required is at front", function() {
|
||||
$("#testForm1").validate();
|
||||
var v = $("#v2").validate();
|
||||
$("#subformRequired").validate();
|
||||
function flatRules(element) {
|
||||
var result = [];
|
||||
jQuery.each($(element).rules(), function(key, value) { result.push(key) });
|
||||
return result.join(" ");
|
||||
}
|
||||
equals( "required minlength", flatRules("#firstname") );
|
||||
equals( "required maxlength minlength", flatRules("#v2-i6") );
|
||||
equals( "required maxlength", flatRules("#co_name") );
|
||||
|
||||
QUnit.reset();
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
v = $("#v2").validate();
|
||||
equals( "required rangelength", flatRules("#v2-i6") );
|
||||
|
||||
$("#subformRequired").validate({
|
||||
rules: {
|
||||
co_name: "required"
|
||||
}
|
||||
});
|
||||
$("#co_name").removeClass();
|
||||
equals( "required maxlength", flatRules("#co_name") );
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
});
|
||||
|
||||
test("rules(), evaluate dynamic parameters", function() {
|
||||
expect(2);
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: function(element) {
|
||||
equals( $("#firstnamec")[0], element );
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
same( $("#firstnamec").rules(), {min:12});
|
||||
});
|
||||
|
||||
test("rules(), class and attribute combinations", function() {
|
||||
|
||||
$.validator.addMethod("customMethod1", function() {
|
||||
return false;
|
||||
}, "");
|
||||
$.validator.addMethod("customMethod2", function() {
|
||||
return false;
|
||||
}, "");
|
||||
var v = $("#v2").validate({
|
||||
rules: {
|
||||
'v2-i7': {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
customMethod: true
|
||||
}
|
||||
}
|
||||
});
|
||||
same( $("#v2-i1").rules(), { required: true });
|
||||
same( $("#v2-i2").rules(), { required: true, email: true });
|
||||
same( $("#v2-i3").rules(), { url: true });
|
||||
same( $("#v2-i4").rules(), { required: true, minlength: 2 });
|
||||
same( $("#v2-i5").rules(), { required: true, minlength: 2, maxlength: 5, customMethod1: "123" });
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
same( $("#v2-i5").rules(), { required: true, customMethod1: "123", rangelength: [2, 5] });
|
||||
same( $("#v2-i6").rules(), { required: true, customMethod2: true, rangelength: [2, 5] });
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
same( $("#v2-i7").rules(), { required: true, minlength: 2, customMethod: true });
|
||||
|
||||
delete $.validator.methods.customMethod1;
|
||||
delete $.validator.messages.customMethod1;
|
||||
delete $.validator.methods.customMethod2;
|
||||
delete $.validator.messages.customMethod2;
|
||||
});
|
||||
|
||||
test("rules(), dependency checks", function() {
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: {
|
||||
param: 5,
|
||||
depends: function(el) {
|
||||
return /^a/.test($(el).val());
|
||||
}
|
||||
}
|
||||
},
|
||||
lastname: {
|
||||
max: {
|
||||
param: 12
|
||||
},
|
||||
email: {
|
||||
depends: function() { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var rules = $("#firstnamec").rules();
|
||||
equals( 0, v.objectLength(rules) );
|
||||
|
||||
$("#firstnamec").val('ab');
|
||||
same( $("#firstnamec").rules(), {min:5});
|
||||
|
||||
same( $("#lastnamec").rules(), {max:12, email:true});
|
||||
});
|
||||
|
||||
test("rules(), add and remove", function() {
|
||||
$.validator.addMethod("customMethod1", function() {
|
||||
return false;
|
||||
}, "");
|
||||
$("#v2").validate();
|
||||
var removedAttrs = $("#v2-i5").removeClass("required").removeAttrs("minlength maxlength");
|
||||
same( $("#v2-i5").rules(), { customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").addClass("required").attr(removedAttrs);
|
||||
same( $("#v2-i5").rules(), { required: true, minlength: 2, maxlength: 5, customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").addClass("email").attr({min: 5});
|
||||
same( $("#v2-i5").rules(), { required: true, email: true, minlength: 2, maxlength: 5, min: 5, customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").removeClass("required email").removeAttrs("minlength maxlength customMethod1 min");
|
||||
same( $("#v2-i5").rules(), {});
|
||||
|
||||
delete $.validator.methods.customMethod1;
|
||||
delete $.validator.messages.customMethod1;
|
||||
});
|
||||
|
||||
test("rules(), add and remove static rules", function() {
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: "required date"
|
||||
}
|
||||
});
|
||||
same( $("#firstnamec").rules(), { required: true, date: true } );
|
||||
|
||||
$("#firstnamec").rules("remove", "date")
|
||||
same( $("#firstnamec").rules(), { required: true } );
|
||||
$("#firstnamec").rules("add", "email");
|
||||
same( $("#firstnamec").rules(), { required: true, email: true } );
|
||||
|
||||
$("#firstnamec").rules("remove", "required");
|
||||
same( $("#firstnamec").rules(), { email: true } );
|
||||
|
||||
same( $("#firstnamec").rules("remove"), { email: true } );
|
||||
same( $("#firstnamec").rules(), { } );
|
||||
|
||||
$("#firstnamec").rules("add", "required email");
|
||||
same( $("#firstnamec").rules(), { required: true, email: true } );
|
||||
|
||||
|
||||
same( $("#lastnamec").rules(), {} );
|
||||
$("#lastnamec").rules("add", "required");
|
||||
$("#lastnamec").rules("add", {
|
||||
minlength: 2
|
||||
});
|
||||
same( $("#lastnamec").rules(), { required: true, minlength: 2 } );
|
||||
|
||||
|
||||
var removedRules = $("#lastnamec").rules("remove", "required email");
|
||||
same( $("#lastnamec").rules(), { minlength: 2 } );
|
||||
$("#lastnamec").rules("add", removedRules);
|
||||
same( $("#lastnamec").rules(), { required: true, minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules(), add messages", function() {
|
||||
$("#firstnamec").attr("title", null);
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: "required"
|
||||
}
|
||||
});
|
||||
$("#testForm1clean").valid();
|
||||
$("#firstnamec").valid();
|
||||
same( v.settings.messages.firstname, undefined );
|
||||
|
||||
$("#firstnamec").rules("add", {
|
||||
messages: {
|
||||
required: "required"
|
||||
}
|
||||
});
|
||||
|
||||
$("#firstnamec").valid();
|
||||
same( v.errorList[0] && v.errorList[0].message, "required" );
|
||||
});
|
444
www/include/jslibs/jquery-validation/test/selects/index.html
Normal file
444
www/include/jslibs/jquery-validation/test/selects/index.html
Normal file
@@ -0,0 +1,444 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Fun with jQuery</title>
|
||||
|
||||
<script src="http://www.google.com/jsapi"></script>
|
||||
<script>
|
||||
google.load("jquery", "1");
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$.fn.options = function(selector) {
|
||||
return this.each(function() {
|
||||
function container(select) {
|
||||
if (select.next().is(".option-container")) {
|
||||
return $(select).next();
|
||||
}
|
||||
return $('<select class="option-container" />').append(select.children()).insertAfter(select).hide();
|
||||
}
|
||||
var container = container($(this));
|
||||
$(this).empty().append(container.children(selector).clone());
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#State").hide()
|
||||
|
||||
$("#Country").change(function() {
|
||||
var selected = this.options[this.selectedIndex].value;
|
||||
if (selected == "US") {
|
||||
$("#State").show().options(".state");
|
||||
} else if (selected == "CA") {
|
||||
$("#State").show().options(".province");
|
||||
} else {
|
||||
$("#State").hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
Mission:
|
||||
|
||||
<xmp>
|
||||
CODE
|
||||
|
||||
</xmp>
|
||||
|
||||
|
||||
<select size="1" id="Country" name="country">
|
||||
<option value="">Select One</option>
|
||||
|
||||
<option value="US" selected="selected">United States</option>
|
||||
<option value="CA">Canada</option>
|
||||
<option value="">----------</option>
|
||||
<option value="AF">Afghanistan</option>
|
||||
<option value="AL">Albania</option>
|
||||
<option value="DZ">Algeria</option>
|
||||
|
||||
<option value="AS">American Samoa</option>
|
||||
<option value="AD">Andorra</option>
|
||||
<option value="AO">Angola</option>
|
||||
<option value="AI">Anguilla</option>
|
||||
<option value="AQ">Antarctica</option>
|
||||
<option value="AG">Antigua and Barbuda</option>
|
||||
|
||||
<option value="AR">Argentina</option>
|
||||
<option value="AM">Armenia</option>
|
||||
<option value="AW">Aruba</option>
|
||||
<option value="AU">Australia</option>
|
||||
<option value="AT">Austria</option>
|
||||
<option value="AZ">Azerbaidjan</option>
|
||||
|
||||
<option value="BS">Bahamas</option>
|
||||
<option value="BH">Bahrain</option>
|
||||
<option value="BD">Bangladesh</option>
|
||||
<option value="BB">Barbados</option>
|
||||
<option value="BY">Belarus</option>
|
||||
<option value="BE">Belgium</option>
|
||||
|
||||
<option value="BZ">Belize</option>
|
||||
<option value="BJ">Benin</option>
|
||||
<option value="BM">Bermuda</option>
|
||||
<option value="BT">Bhutan</option>
|
||||
<option value="BO">Bolivia</option>
|
||||
<option value="BA">Bosnia-Herzegovina</option>
|
||||
|
||||
<option value="BW">Botswana</option>
|
||||
<option value="BV">Bouvet Island</option>
|
||||
<option value="BR">Brazil</option>
|
||||
<option value="IO">British Indian Ocean Territory</option>
|
||||
<option value="BN">Brunei Darussalam</option>
|
||||
<option value="BG">Bulgaria</option>
|
||||
|
||||
<option value="BF">Burkina Faso</option>
|
||||
<option value="BI">Burundi</option>
|
||||
<option value="KH">Cambodia</option>
|
||||
<option value="CM">Cameroon</option>
|
||||
<option value="CV">Cape Verde</option>
|
||||
<option value="KY">Cayman Islands</option>
|
||||
|
||||
<option value="CF">Central African Republic</option>
|
||||
<option value="TD">Chad</option>
|
||||
<option value="CL">Chile</option>
|
||||
<option value="CN">China</option>
|
||||
<option value="CX">Christmas Island</option>
|
||||
<option value="CC">Cocos (Keeling) Islands</option>
|
||||
|
||||
<option value="CO">Colombia</option>
|
||||
<option value="KM">Comoros</option>
|
||||
<option value="CG">Congo</option>
|
||||
<option value="CK">Cook Islands</option>
|
||||
<option value="CR">Costa Rica</option>
|
||||
<option value="HR">Croatia</option>
|
||||
|
||||
<option value="CU">Cuba</option>
|
||||
<option value="CY">Cyprus</option>
|
||||
<option value="CZ">Czech Republic</option>
|
||||
<option value="DK">Denmark</option>
|
||||
<option value="DJ">Djibouti</option>
|
||||
<option value="DM">Dominica</option>
|
||||
|
||||
<option value="DO">Dominican Republic</option>
|
||||
<option value="TP">East Timor</option>
|
||||
<option value="EC">Ecuador</option>
|
||||
<option value="EG">Egypt</option>
|
||||
<option value="SV">El Salvador</option>
|
||||
<option value="GQ">Equatorial Guinea</option>
|
||||
|
||||
<option value="ER">Eritrea</option>
|
||||
<option value="EE">Estonia</option>
|
||||
<option value="ET">Ethiopia</option>
|
||||
<option value="FK">Falkland Islands</option>
|
||||
<option value="FO">Faroe Islands</option>
|
||||
<option value="FJ">Fiji</option>
|
||||
|
||||
<option value="FI">Finland</option>
|
||||
<option value="CS">Former Czechoslovakia</option>
|
||||
<option value="SU">Former USSR</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="FX">France (European Territory)</option>
|
||||
<option value="GF">French Guyana</option>
|
||||
|
||||
<option value="TF">French Southern Territories</option>
|
||||
<option value="GA">Gabon</option>
|
||||
<option value="GM">Gambia</option>
|
||||
<option value="GE">Georgia</option>
|
||||
<option value="DE">Germany</option>
|
||||
<option value="GH">Ghana</option>
|
||||
|
||||
<option value="GI">Gibraltar</option>
|
||||
<option value="GB">Great Britain</option>
|
||||
<option value="GR">Greece</option>
|
||||
<option value="GL">Greenland</option>
|
||||
<option value="GD">Grenada</option>
|
||||
<option value="GP">Guadeloupe (French)</option>
|
||||
|
||||
<option value="GU">Guam (USA)</option>
|
||||
<option value="GT">Guatemala</option>
|
||||
<option value="GN">Guinea</option>
|
||||
<option value="GW">Guinea Bissau</option>
|
||||
<option value="GY">Guyana</option>
|
||||
<option value="HT">Haiti</option>
|
||||
|
||||
<option value="HM">Heard and McDonald Islands</option>
|
||||
<option value="HN">Honduras</option>
|
||||
<option value="HK">Hong Kong</option>
|
||||
<option value="HU">Hungary</option>
|
||||
<option value="IS">Iceland</option>
|
||||
<option value="IN">India</option>
|
||||
|
||||
<option value="ID">Indonesia</option>
|
||||
<option value="INT">International</option>
|
||||
<option value="IR">Iran</option>
|
||||
<option value="IQ">Iraq</option>
|
||||
<option value="IE">Ireland</option>
|
||||
<option value="IL">Israel</option>
|
||||
|
||||
<option value="IT">Italy</option>
|
||||
<option value="CI">Ivory Coast (Cote D'Ivoire)</option>
|
||||
<option value="JM">Jamaica</option>
|
||||
<option value="JP">Japan</option>
|
||||
<option value="JO">Jordan</option>
|
||||
<option value="KZ">Kazakhstan</option>
|
||||
|
||||
<option value="KE">Kenya</option>
|
||||
<option value="KI">Kiribati</option>
|
||||
<option value="KW">Kuwait</option>
|
||||
<option value="KG">Kyrgyzstan</option>
|
||||
<option value="LA">Laos</option>
|
||||
<option value="LV">Latvia</option>
|
||||
|
||||
<option value="LB">Lebanon</option>
|
||||
<option value="LS">Lesotho</option>
|
||||
<option value="LR">Liberia</option>
|
||||
<option value="LY">Libya</option>
|
||||
<option value="LI">Liechtenstein</option>
|
||||
<option value="LT">Lithuania</option>
|
||||
|
||||
<option value="LU">Luxembourg</option>
|
||||
<option value="MO">Macau</option>
|
||||
<option value="MK">Macedonia</option>
|
||||
<option value="MG">Madagascar</option>
|
||||
<option value="MW">Malawi</option>
|
||||
<option value="MY">Malaysia</option>
|
||||
|
||||
<option value="MV">Maldives</option>
|
||||
<option value="ML">Mali</option>
|
||||
<option value="MT">Malta</option>
|
||||
<option value="MH">Marshall Islands</option>
|
||||
<option value="MQ">Martinique (French)</option>
|
||||
<option value="MR">Mauritania</option>
|
||||
|
||||
<option value="MU">Mauritius</option>
|
||||
<option value="YT">Mayotte</option>
|
||||
<option value="MX">Mexico</option>
|
||||
<option value="FM">Micronesia</option>
|
||||
<option value="MD">Moldavia</option>
|
||||
<option value="MC">Monaco</option>
|
||||
|
||||
<option value="MN">Mongolia</option>
|
||||
<option value="MS">Montserrat</option>
|
||||
<option value="MA">Morocco</option>
|
||||
<option value="MZ">Mozambique</option>
|
||||
<option value="MM">Myanmar</option>
|
||||
<option value="NA">Namibia</option>
|
||||
|
||||
<option value="NR">Nauru</option>
|
||||
<option value="NP">Nepal</option>
|
||||
<option value="NL">Netherlands</option>
|
||||
<option value="AN">Netherlands Antilles</option>
|
||||
<option value="NT">Neutral Zone</option>
|
||||
<option value="NC">New Caledonia (French)</option>
|
||||
|
||||
<option value="NZ">New Zealand</option>
|
||||
<option value="NI">Nicaragua</option>
|
||||
<option value="NE">Niger</option>
|
||||
<option value="NG">Nigeria</option>
|
||||
<option value="NU">Niue</option>
|
||||
<option value="NF">Norfolk Island</option>
|
||||
|
||||
<option value="KP">North Korea</option>
|
||||
<option value="MP">Northern Mariana Islands</option>
|
||||
<option value="NO">Norway</option>
|
||||
<option value="OM">Oman</option>
|
||||
<option value="PK">Pakistan</option>
|
||||
<option value="PW">Palau</option>
|
||||
|
||||
<option value="PA">Panama</option>
|
||||
<option value="PG">Papua New Guinea</option>
|
||||
<option value="PY">Paraguay</option>
|
||||
<option value="PE">Peru</option>
|
||||
<option value="PH">Philippines</option>
|
||||
<option value="PN">Pitcairn Island</option>
|
||||
|
||||
<option value="PL">Poland</option>
|
||||
<option value="PF">Polynesia (French)</option>
|
||||
<option value="PT">Portugal</option>
|
||||
<option value="PR">Puerto Rico</option>
|
||||
<option value="QA">Qatar</option>
|
||||
<option value="RE">Reunion (French)</option>
|
||||
|
||||
<option value="RO">Romania</option>
|
||||
<option value="RU">Russian Federation</option>
|
||||
<option value="RW">Rwanda</option>
|
||||
<option value="GS">S. Georgia & S. Sandwich Isls.</option>
|
||||
<option value="SH">Saint Helena</option>
|
||||
<option value="KN">Saint Kitts & Nevis Anguilla</option>
|
||||
|
||||
<option value="LC">Saint Lucia</option>
|
||||
<option value="PM">Saint Pierre and Miquelon</option>
|
||||
<option value="ST">Saint Tome (Sao Tome) and Principe</option>
|
||||
<option value="VC">Saint Vincent & Grenadines</option>
|
||||
<option value="WS">Samoa</option>
|
||||
<option value="SM">San Marino</option>
|
||||
|
||||
<option value="SA">Saudi Arabia</option>
|
||||
<option value="SN">Senegal</option>
|
||||
<option value="SC">Seychelles</option>
|
||||
<option value="SL">Sierra Leone</option>
|
||||
<option value="SG">Singapore</option>
|
||||
<option value="SK">Slovak Republic</option>
|
||||
|
||||
<option value="SI">Slovenia</option>
|
||||
<option value="SB">Solomon Islands</option>
|
||||
<option value="SO">Somalia</option>
|
||||
<option value="ZA">South Africa</option>
|
||||
<option value="KR">South Korea</option>
|
||||
<option value="ES">Spain</option>
|
||||
|
||||
<option value="LK">Sri Lanka</option>
|
||||
<option value="SD">Sudan</option>
|
||||
<option value="SR">Suriname</option>
|
||||
<option value="SJ">Svalbard and Jan Mayen Islands</option>
|
||||
<option value="SZ">Swaziland</option>
|
||||
<option value="SE">Sweden</option>
|
||||
|
||||
<option value="CH">Switzerland</option>
|
||||
<option value="SY">Syria</option>
|
||||
<option value="TJ">Tadjikistan</option>
|
||||
<option value="TW">Taiwan</option>
|
||||
<option value="TZ">Tanzania</option>
|
||||
<option value="TH">Thailand</option>
|
||||
|
||||
<option value="TG">Togo</option>
|
||||
<option value="TK">Tokelau</option>
|
||||
<option value="TO">Tonga</option>
|
||||
<option value="TT">Trinidad and Tobago</option>
|
||||
<option value="TN">Tunisia</option>
|
||||
<option value="TR">Turkey</option>
|
||||
|
||||
<option value="TM">Turkmenistan</option>
|
||||
<option value="TC">Turks and Caicos Islands</option>
|
||||
<option value="TV">Tuvalu</option>
|
||||
<option value="UG">Uganda</option>
|
||||
<option value="UA">Ukraine</option>
|
||||
<option value="AE">United Arab Emirates</option>
|
||||
|
||||
<option value="GB">United Kingdom</option>
|
||||
<option value="UY">Uruguay</option>
|
||||
<option value="MIL">USA Military</option>
|
||||
<option value="UM">USA Minor Outlying Islands</option>
|
||||
<option value="UZ">Uzbekistan</option>
|
||||
<option value="VU">Vanuatu</option>
|
||||
|
||||
<option value="VA">Vatican City State</option>
|
||||
<option value="VE">Venezuela</option>
|
||||
<option value="VN">Vietnam</option>
|
||||
<option value="VG">Virgin Islands (British)</option>
|
||||
<option value="VI">Virgin Islands (USA)</option>
|
||||
<option value="WF">Wallis and Futuna Islands</option>
|
||||
|
||||
<option value="EH">Western Sahara</option>
|
||||
<option value="YE">Yemen</option>
|
||||
<option value="YU">Yugoslavia</option>
|
||||
<option value="ZR">Zaire</option>
|
||||
<option value="ZM">Zambia</option>
|
||||
<option value="ZW">Zimbabwe</option>
|
||||
|
||||
</select>
|
||||
<br />
|
||||
|
||||
<select id="State" name="State">
|
||||
|
||||
<option value="" class="selectone">Select One</option>
|
||||
<option value="AB" class="province">Alberta</option>
|
||||
<option value="BC" class="province">British Columbia</option>
|
||||
<option value="MB" class="province">Manitoba</option>
|
||||
|
||||
<option value="NB" class="province">New Brunswick</option>
|
||||
<option value="NF" class="province">Newfoundland</option>
|
||||
<option value="NT" class="province">Northwest Territories</option>
|
||||
<option value="NS" class="province">Nova Scotia</option>
|
||||
<option value="NU" class="province">Nunavut</option>
|
||||
<option value="ON" class="province">Ontario</option>
|
||||
|
||||
<option value="PE" class="province">Prince Edward Island</option>
|
||||
<option value="QC" class="province">Quebec</option>
|
||||
<option value="SK" class="province">Saskatchewan</option>
|
||||
<option value="YT" class="province">Yukon Territory</option>
|
||||
|
||||
<option value="AK" class="state">Alaska</option>
|
||||
<option value="AL" class="state">Alabama</option>
|
||||
|
||||
<option value="AR" class="state">Arkansas</option>
|
||||
<option value="AZ" class="state">Arizona</option>
|
||||
<option value="CA" class="state">California</option>
|
||||
<option value="CO" class="state">Colorado</option>
|
||||
<option value="CT" class="state">Connecticut</option>
|
||||
<option value="DC" class="state">District of Columbia</option>
|
||||
|
||||
<option value="DE" class="state">Delaware</option>
|
||||
<option value="FL" class="state">Florida</option>
|
||||
<option value="GA" class="state">Georgia</option>
|
||||
<option value="HI" class="state">Hawaii</option>
|
||||
<option value="IA" class="state">Iowa</option>
|
||||
<option value="ID" class="state">Idaho</option>
|
||||
|
||||
<option value="IL" class="state">Illinois</option>
|
||||
<option value="IN" class="state">Indiana</option>
|
||||
<option value="KS" class="state">Kansas</option>
|
||||
<option value="KY" class="state">Kentucky</option>
|
||||
<option value="LA" class="state">Louisiana</option>
|
||||
<option value="MA" class="state">Massachusetts</option>
|
||||
|
||||
<option value="MD" class="state">Maryland</option>
|
||||
<option value="ME" class="state">Maine</option>
|
||||
<option value="MI" class="state">Michigan</option>
|
||||
<option value="MN" class="state">Minnesota</option>
|
||||
<option value="MO" class="state">Missouri</option>
|
||||
<option value="MS" class="state">Mississippi</option>
|
||||
|
||||
<option value="MT" class="state">Montana</option>
|
||||
<option value="NC" class="state">North Carolina</option>
|
||||
<option value="ND" class="state">North Dakota</option>
|
||||
<option value="NE" class="state">Nebraska</option>
|
||||
<option value="NH" class="state">New Hampshire</option>
|
||||
<option value="NJ" class="state">New Jersey</option>
|
||||
|
||||
<option value="NM" class="state">New Mexico</option>
|
||||
<option value="NV" class="state">Nevada</option>
|
||||
<option value="NY" class="state">New York</option>
|
||||
<option value="OH" class="state">Ohio</option>
|
||||
<option value="OK" class="state">Oklahoma</option>
|
||||
<option value="OR" class="state">Oregon</option>
|
||||
|
||||
<option value="PA" class="state">Pennsylvania</option>
|
||||
<option value="PR" class="state">Puerto Rico</option>
|
||||
<option value="RI" class="state">Rhode Island</option>
|
||||
<option value="SC" class="state">South Carolina</option>
|
||||
<option value="SD" class="state">South Dakota</option>
|
||||
<option value="TN" class="state">Tennessee</option>
|
||||
|
||||
<option value="TX" class="state">Texas</option>
|
||||
<option value="UT" class="state">Utah</option>
|
||||
<option value="VA" class="state">Virginia</option>
|
||||
<option value="VT" class="state">Vermont</option>
|
||||
<option value="WA" class="state">Washington</option>
|
||||
<option value="WI" class="state">Wisconsin</option>
|
||||
|
||||
<option value="WV" class="state">West Virginia</option>
|
||||
<option value="WY" class="state">Wyoming</option>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-1499652-1";
|
||||
urchinTracker();
|
||||
</script></body>
|
||||
</html>
|
78
www/include/jslibs/jquery-validation/test/tabs.html
Normal file
78
www/include/jslibs/jquery-validation/test/tabs.html
Normal file
@@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../demo/css/screen.css" />
|
||||
<link rel="stylesheet" href="../../../themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)">
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../../../ui/current/ui.tabs.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.metadata.js"></script>
|
||||
<script type="text/javascript" src="../jquery.validate.js"></script>
|
||||
<script src="firebug/firebug.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$().ready(function() {
|
||||
$("#commentForm").validate({debug:true});
|
||||
$("#example > ul").tabs();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
form.cmxform { width: 470px; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
|
||||
<div id="example" class="flora">
|
||||
<ul>
|
||||
|
||||
<li><a href="#fragment-1"><span>One</span></a></li>
|
||||
<li><a href="#fragment-2"><span>Two</span></a></li>
|
||||
<li><a href="#fragment-3"><span>Three</span></a></li>
|
||||
</ul>
|
||||
<div id="fragment-1">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname">Name (required, at least 2 characters)</label>
|
||||
<input id="cname" name="name" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail">E-Mail (required)</label>
|
||||
<input id="cemail" name="email" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl">URL (optional)</label>
|
||||
<input id="curl" name="url" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment">Your comment (required)</label>
|
||||
<textarea id="ccomment" name="comment" class="{required:true}"></textarea>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
<div id="fragment-2">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
</div>
|
||||
<div id="fragment-3">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
1121
www/include/jslibs/jquery-validation/test/test.js
vendored
Normal file
1121
www/include/jslibs/jquery-validation/test/test.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
www/include/jslibs/jquery-validation/test/users.php
Normal file
11
www/include/jslibs/jquery-validation/test/users.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['username']));
|
||||
//sleep(1);
|
||||
$users = array('asdf', 'Peter', 'Peter2', 'George');
|
||||
$valid = 'true';
|
||||
foreach($users as $user) {
|
||||
if( strtolower($user) == $request )
|
||||
$valid = 'false';
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
11
www/include/jslibs/jquery-validation/test/users2.php
Normal file
11
www/include/jslibs/jquery-validation/test/users2.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['username']));
|
||||
//sleep(1);
|
||||
$users = array('asdf', 'Peter', 'Peter2', 'George');
|
||||
$valid = 'true';
|
||||
foreach($users as $user) {
|
||||
if( strtolower($user) == $request )
|
||||
$valid = "\"$user is already taken, please try something else\"";
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
Reference in New Issue
Block a user