Form Validation Toolkit

Data Type Tests



Minimum Steps to Validation:

1. Set the validation attributes of the input field
2. Attach (Initiate) the JavaScript validation process to the form (or the fields)

Alphanumeric

These are examples for alphanumeric entries.
data-val-checkType="alphanumeric" can be specified as an attribute to check for a valid alphanumeric string (letter and numbers). Additionally, data formats are available for this type by supplying data-val-checkFormat="" to check for username and password formats.

Example: (positive numbers)
<input type="text" name="alpha1" data-val-required="1" data-val-checkType="alphanumeric"  />
<input type="text" name="alpha2" data-val-required="1" data-val-checkType="alphanumeric" data-val-checkFormat="username"  />
<input type="text" name="alpha3" data-val-required="1" data-val-checkType="alphanumeric" data-val-checkFormat="password"  />
<input type="text" name="alpha4" data-val-required="1" data-val-checkType="alphanumeric" data-val-checkFormat="name"  />

<script>
	$('#data-type-test-form').initValidation();
</script>

Alphanumeric Only

Username

Password

Name

This can be attached to a name field or First Name and Last Name field. The requirements are - all letters, no numbers, also allowing dash (-), comma (,), period (.), and space ( ).