<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<!--
/*
* Really easy field validation with Prototype
* http://tetlaw.id.au/view/blog/really-easy-field-validation-with-prototype
* Andrew Tetlaw
* Version 1.5.3 (2006-07-15)
*
* Copyright (c) 2006 Andrew Tetlaw
* http://www.opensource.org/licenses/mit-license.php
*/
-->
<head>
<script src="prototype.js" type="text/javascript"></script>
<script src="effects.js" type="text/javascript"></script>
<script type="text/javascript" src="fabtabulous.js"></script>
<script type="text/javascript" src="validation_cn.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="container">
<div id="mainmenu">
<ul id="tabs">
<li>
<a href="#standard">Standard</a>
</li>
<li>
<a href="#using-titles">Using Titles</a>
</li>
<li>
<a href="#no-element-ids">No element IDs</a>
</li>
<li>
<a href="#auto-bind-form-valite-by-classname">auto-bind-form-valite-by-classname</a>
</li>
</ul>
<div>
<div class="bar"> </div>
<div class="panel" id="standard">
<form id="test" action="#" method="get">
<fieldset>
<legend>Form</legend>
<div class="form-row">
<div class="field-label"><label for="field1">Name</label>:</div>
<div class="field-widget"><input name="field1" id="field1" class="required" title="Enter your name" /></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field3">Employee Number</label>:</div>
<div class="field-label"><input name="field3" id="field3" class="required validate-alphanum" title="Enter your employee number, please use only alphanumeric characters" /></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field4">Age</label>:</div>
<div class="field-label"><input name="field4" id="field4" class="validate-number" title="Optional: Enter your age"/> (optional)</div>
</div>
<div class="form-row">
<div class="field-label"><label for="field14">MinLength=4 and MaxLength=10</label>:</div>
<div class="field-label"><input name="field14" id="field14" class="required min-length-4 max-length-10"/></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field24">File:png jpg</label>:</div>
<div class="field-label"><input name="field24" id="field24" type='file' class="required validate-file-png-jpg" /> </div>
</div>
<div class="form-row">
<div class="field-label"><label for="field34">Validate Float Range -2.1至3.1</label>:</div>
<div class="field-label"><input name="field34" id="field34" type='text' class="required validate-float-range--2.1-3.1" /> </div>
</div>
<div class="form-row">
<div class="field-label"><label for="field44">Validate Int Range -1至2</label>:</div>
<div class="field-label"><input name="field44" id="field44" type='text' class="required validate-int-range--1-2" /> </div>
</div>
<div class="form-row">
<div class="field-label"><label for="field54">Validate Length Range 3至8</label>:</div>
<div class="field-label"><input name="field54" id="field54" type='text' class="required validate-length-range-3-8" /> </div>
</div>
<div class="form-row">
<div class="field-label"><label for="field64">Max Value 8</label>:</div>
<div class="field-label"><input name="field64" id="field64" type='text' class="required max-value-8" /> </div>
</div>
<div class="form-row">
<div class="field-label"><label for="field74">Min Value 10</label>:</div>
<div class="field-label"><input name="field74" id="field74" type='text' class="required min-value-10" /> </div>
</div>
<div class="form-row">
<div class="field-label"><label for="field84">Equals one item(AA,BB,CC)</label>:</div>
<div class="field-label"><input name="field84" id="field84" type='text' class="required validate-equals-AA-BB-CC" /> </div>
</div>
<div class="form-row">
<div class="field-label"><label for="field94">Use title by class name</label>:</div>
<div class="field-label"><input name="field94" id="field94" type='text' class="required useTitle" title='这里是不能为空的喔,by useTitle'/> </div>
</div>
<div class="form-row">
<div class="field-label"><label for="field6">Sex</label>:</div>
<div class="field-label">
<input type="radio" name="field6" id="field6-male" value="Male" />Male<br />
<input type="radio" name="field6" id="field6-female" value="Female" class="validate-one-required" />Female
</div>
</div>
<div class="form-row">
<div class="field-label"><label for="field5">Donation</label>:</div>
<div class="field-label">
<div id="advice-validate-currency-dollar-field5" class="custom-advice" style="display:none">That $ amount does not compute!</div>
<input name="field5" id="field5" class="validate-currency-dollar" title="Enter a dollar amount for donation" /> (optional)
</div>
</div>
<p><a href="#" onclick="$('email-signup').toggle(); return false">Sign me up for the email newletter!</a></p>
<div id="email-signup" class="form-row" style="display:none;">
<div class="field-label"><label for="field22">Email</label>:</div>
<div class="field-widget"><input name="field22" id="field22" class="required validate-email" title="Optional: Enter your email address" /></div>
</div>
</fieldset>
<input type="submit" value="Submit" /> <input type="button" value="Reset" onclick="valid.reset(); return false" />
</form>
<script type="text/javascript">
function formCallback(result, form) {
window.status = "valiation callback for form '" + form.id + "': result = " + result;
}
var valid = new Validation('test', {immediate : true, onFormValidate : formCallback});
</script>
</div>
<div class="panel" id="using-titles">
<form id="test2" action="#" method="get">
<fieldset>
<legend>Form</legend>
<div class="form-row">
<div class="field-label"><label for="field1-t2">Name</label>:</div>
<div class="field-widget"><input name="field1-t2" id="field1-t2" class="required" title="Enter your name. This is a required field" /></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field3-t2">Employee Number</label>:</div>
<div class="field-label"><input name="field3-t2" id="field3-t2" class="required validate-alphanum" title="Enter your employee number, please use only alphanumeric characters" /></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field4-t2">Age</label>:</div>
<div class="field-label"><input name="field4-t2" id="field4-t2" class="validate-number" title="Optional: Enter your age, please use only numbers" /> (optional)</div>
</div>
<div class="form-row">
<div class="field-label"><label for="field5-t2">Donation</label>:</div>
<div class="field-label"><input name="field5-t2" id="field5-t2" class="validate-currency-dollar" title="Optional: Enter a dollar amount for donation" /> (optional)</div>
</div>
</fieldset>
<input type="submit" value="Submit" /> <input type="button" value="Reset" onclick="valid2.reset(); return false" />
</form>
<script type="text/javascript">
var valid2 = new Validation('test2', {useTitles:true});
</script>
</div>
<div class="panel" id="no-element-ids">
<form id="test3" action="#" method="get">
<fieldset>