Validation

Required plugin

This feature requires the plugin files js/libs/formValidator/jquery.validationEngine.js, js/libs/formValidator/developr.validationEngine.css and the language pack corresponding to your locale, for instance js/libs/formValidator/languages/jquery.validationEngine-en.js

Field Validations

Validations are defined using the input's class attribute. Here are a few examples:

<!-- This field is required and should be a valid email -->
<input value="someone@nowhere.com" class="validate[required,custom[email]]" type="text" name="email" id="email">

<!-- This field is required and should be a valid date -->
<input value="2010-12-01" class="validate[required,custom[date]]" type="text" name="date" id="date">

<!-- This field is required and should be contain only letters and numbers -->
<input value="too many spaces obviously" class="validate[required,custom[onlyLetterNumber]]" type="text" name="special" id="special">

For more details about validators, please refer to the related plugin documentation.

Instantiation

Once your validation rules are set using classes, you must instanciate the validation process:

<script>
$(document).ready(function(){
    $("#formID").validationEngine();
   });
</script>

Now you form will be validated on submit, and if errors are found, the default action will be prevented and error notices will show.

Full documentation

For more details on how to use this plugin, please refer to the plugin's documentation, which will guide you into setting it up, customizing it and also using it with AJAX forms too.