FORM VALIDATION
JavaScript provides a way to validate form’s data on the client’s computer before sending it to the web server. Form validation generally performs two functions.
- Basic Validation− First of all, the form must be checked to make sure all the mandatory fields are filled in. It would require just a loop through each field in the form and check for data.
- Data Format Validation− Secondly, the data that is entered must be checked for correct form and value. Your code must include appropriate logic to test correctness of data.
Validation
- All mandatory fields are filled
- User name
- Mandatory
- Minimum Length
- Password check
- Mandatory
- Minimum Password length
- Include alphabets in lower and upper case, digits and special characters
- Retyped password is same
- Email
- Must contain the @ and . character
- Must have at least one character before and after the @
- Must be at least two characters after . (dot)
- Mobile number
- Check digits only
- Length of mobile number
- Checkbox (can use ‘required’ or function)
- Atleast one choice selected
- Accept terms and conditions
- File
- Extension
- Max size