Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 5153a418cd
Fetching contributors…

Cannot retrieve contributors at this time

94 lines (90 sloc) 4.006 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>JQuery Validation Engine</title>
<link rel="stylesheet" href="../css/validationEngine.jquery.css" type="text/css"/>
<link rel="stylesheet" href="../css/template.css" type="text/css"/>
<script src="../js/jquery-1.6.min.js" type="text/javascript">
<script src="../js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
<script src="../js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
// This method is called right before the ajax form validation request
// it is typically used to setup some visuals ("Please wait...");
// you may return a false to stop the request
function beforeCall(form, options){
if (console)
console.log("Right before the AJAX form validation call");
return true;
// Called once the server replies to the ajax form validation request
function ajaxValidationCallback(status, form, json, options){
if (console)
if (status === true) {
alert("the form is valid!");
// uncomment these lines to submit the form to form.action
// form.validationEngine('detach');
// form.submit();
// or you may use AJAX again to submit the data
ajaxFormValidation: true,
onAjaxFormComplete: ajaxValidationCallback,
onBeforeAjaxFormValidation: beforeCall
<a href="#" onclick="alert(jQuery('#formID').validationEngine({evaluate:true}))">Return true or false without binding anything</a>
| <a href="#" onclick="jQuery.validationEngine.buildPrompt('#formID','This is an example','error')">Build a prompt on a div</a>
| <a href="#" onclick="jQuery.validationEngine.loadValidation('#date')">Load validation date</a>
| <a href="#" onclick="jQuery.validationEngine.closePrompt('.formError',true)">Close all prompt</a>
| <a href="../index.html" onclick="">Back to index</a>
<p style="color:red; text-align:center">Please run this demo from a WebServer (ie. http://localhost:9173/demoAjax.html after running the demo server), it will fail if you double click demoAjax.html -> It needs a server.
This demonstrations shows the use of Ajax <b>form</b>
and <b>field</b>
The form validation implements callback hooks, so please check the javascript console
<form id="formID" class="formular" method="post" action="ajaxSubmitForm" style="width:600px">
Ajax validation
<span>Desired username (ajax validation, only <b>karnius</b> is available) : </span>
<input value="karnius" class="validate[required,custom[onlyLetterNumber],maxSize[20],ajax[ajaxUserCall]] text-input" type="text" name="user" id="user" />
<span>First name (ajax validation, only <b>duncan</b> is available): </span>
<input value="olivier" class="validate[custom[onlyLetterSp],maxSize[100],ajax[ajaxNameCall]] text-input" type="text" name="firstname" id="firstname" />
<span>Email address : </span>
<input value="" class="validate[required,custom[email]] text-input" type="text" name="email" id="email" />
<input class="submit" type="submit" value="Validate &amp; Send the form!"/><hr/>
Jump to Line
Something went wrong with that request. Please try again.