Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How To validate Our Form using jquery for textbox alphabets only

Posted on 2011-09-16
4
Medium Priority
?
747 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 500 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:Gurvinder Pal Singh
Gurvinder Pal Singh earned 500 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 111

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

718 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