Solved

How To validate Our Form using jquery for textbox alphabets only

Posted on 2011-09-16
4
737 Views
Last Modified: 2012-05-12
I want To validate my form using jquery .Any body there plz help  me out with code
0
Comment
Question by:savsoft
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 125 total points
ID: 36553237
0
 

Author Comment

by:savsoft
ID: 36553254
I want the solution for jquery which can validate the whole form all along
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 125 total points
ID: 36553264
so, you can set that validation for all the form elements
or

$("input").each(function(){
  $(this).onkeyup(function(){
    $(this).val($(this).val().replace(/[^a-z]/g,''));
  });
});

this will make sure that all textboxes in the form cannot have anything else than alphabets
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 36554294
Whatever you might do with jQuery or other client-side validation, you must also do on the server side after the form data has been submitted.  You can use a regular expression something like this to detect unacceptable characters.  You can use preg_replace to change these characters into blanks, NULLs, question marks, etc.

$regex = '/[^A-Z ]/i';
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Pass form variable from one web form to another 2 29
Hide un-named HTML Label with CSS 14 36
Inserting data into database 10 34
Copying table data to one another 15 29
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question