Solved

How To validate Our Form using jquery for textbox alphabets only

Posted on 2011-09-16
4
735 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

776 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