Validation Types
How many different ways or types of validation can we carry out.- → Scenarios: When to Validation
- → Required Inputs
- → Min-Length Validation
- → Data Type Validation
- → Custom Expression Validation
Required Inputs
Validation can be setup so certain inputs are required. This can be done simply by setting the required attribute of an input. Example.<label class="text" for="name"/> <span>Name</span> <input type="text" name="name" id="name" maxlength="20" data-val-required="1" data-val-min-length="5" data-val-error-title="Name" data-val-error-text="Name is required. Minimum length is 5 characters." /> </label>Example:
In addition, a set of inputs can be turned into required or not based on custom conditional logic, i.e. on button click or selection of a value. Example.