Validation with help of Java Script




  • JavaScript is Client Side Scripting Language.
  • we can use them for validation too.
  • here I am going to introduce you a small demo.
  • First of all, See this is designing portion.





  • On client's Click, it will call the function Validation().
  • which is a basically a javascript function. which have different methods related to javascript
  • in validation function we had created many small functions which will return an error message or confirm validation respond.
  • in alert(errors) we are going to print Error Message.
  • it will be a pop-up message.


  •  The check name function will allow entries between a to z (a-z) and A to Z(A-Z).
  • so basically it will not accept Special character and numbers in the name.
  • and also will not accept the blank value.
  • TextName: will get the value of textbox - txtname which we had created above.
  • expValidation : have a pattern for UserName.


  •  CheckMail() function is used to check that textbox value is fulfill the basic email pattern or not.
  • like an email-ID is basically made up like it has some text then it has @ symbol after that some value then.( DOT). and than some extension like (.com , .in etc.)
  • so in exp - we have a simple a pattern. which must be followed to be an email-ID.


  •  CheckAge: it will allow only 17+ year only.
  • TA will have the value of textbox txtage which we had created above.


  •  this is a simple function which will not accept null value or blank value.


  •  This Function will have mainly 2 things.
  • 1. txtconfirmPassword field should not be null.
  • 2. and txtpassword and txtConfrmPassword field must have the same values.
  • TP - It will take the value of txtpassword.
  • TCF- It will have the value of txtcnfpassword.


  •  Last But not the list checkmobileNumber.
  • to be a mobile number it must have 10 digits.







  • the output be like.



  • Jalsaa karrr

Comments

Popular posts from this blog

Asp.Net Validation

Fundamental of OOPS From Scratch to End