Solved

How To validate Our Form using jquery for textbox alphabets only

Posted on 2011-09-16
4
731 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
Comment Utility
0
 

Author Comment

by:savsoft
Comment Utility
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
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now