Validation is applied in form elements using Javascript