Form Validation Toolkit

Force Data Type Examples

Following attributes are not directly related to the validation tool. However, they are helpful utilities:
Attribute Values Description
data-forceFormat="" 'int' Force Integer value only
'neg-int' Force negative Integer value only
'float' Force Float value only
'neg-float' Force negative Float value only
'alphanumeric' Force letters and numbers only
'username' Force username characters only
'password' Force password only

Force Data Type

Applying this attribute with the above options will force the input field to acept only the specified type of characters. This can be applied to an input whether or not it is a required field or has other 'data-val-' attributes.

Example:
<input type="text" name="int" data-forceFormat="int" />
<input type="text" name="neg-int"  data-forceFormat="neg-int" />
<input type="text" name="float"  data-forceFormat="float" />
<input type="text" name="neg-float"  data-forceFormat="neg-float" />
<input type="text" name="alpha"  data-forceFormat="alphanumeric" />
<input type="text" name="username"  data-forceFormat="username"  />
<input type="text" name="password"  data-forceFormat="password"  />