Form Validation

Form Validation

Java script validation for checking special characters and white spaces and give an alert.Please help me urgent

Thanks in advance.

View Answers

March 16, 2011 at 4:55 PM

<script>
var iChars = "`~!@#$%^&*()+=-_:[]\;,./{}|\":<>?'";
    function hasWhiteSpace(s){
     reg = new RegExp(/^\s+$/);
     if (reg.test(s)) {
          alert("Please Check Your Fields For Spaces");
          return false;
     }
     return true;
}  
    function test(){
     var count=document.form.text.value.length;
     for (var i = 0; i < count; i++) {
     if ((iChars.indexOf(document.form.text.value.charAt(i)) != -1)||hasWhiteSpace(document.form.text.value)) 
     {
     alert("Contains special characters or whitespace. These are not allowed.");
     document.form.text.value="";
     return false;
      }
    }   
     }
     </script>
     <form name="form" onsubmit="return test();">
     Enter data: <input type="text" name="text">

     <input type="submit" value="submit">
     </pre>
     </form>









Related Tutorials/Questions & Answers:
form validation
form validation  how the form validation is done in jsf form using javaScript
Form Validation
Form Validation  Java script validation for checking special characters and white spaces and give an alert.Please help me urgent Thanks in advance
Advertisements
JavaScript Form Validation
JavaScript Form Validation  JavaScript Form Validation
form validation
form validation  <form name="form" method="post" action="process.php" onsubmit="return validate(); "> <table align="center" border="1px... want validation code,username minimum 8 char,password length must >6,and one
Form validation
Form validation  Hi Everyone Can someone assist me with a complete code to validate a form. e.g where the user must insert an ID number it should check if the user entered the correct data and within a valid range. This must
spring form validation
spring form validation  how can we validate a web form using spring, try to give an example of the form containing some fields and their validations,ASAP......   Please visit the following link: Spring form validation
Ajax form validation Example
Ajax form validation Example  Hi, I want to validate my ajax form. Please give me good code for Ajax form validation. Thanks   Hi, Read... to validate form in Ajax using jQuery framework. Thanks
Custom Form Validation - PHP
Custom Form Validation  Which is the best way or where should I implement the custom validation rules such as ? using number, capital letters and symbols to secure the password
HTML Form Validation example
HTML Form Validation example  Can anyone guide me how to validate the user name and password field in HTML using simple or JavaScript Validation. Thanks in advance!   <form method="post" onsubmit="return
Form Validation with JavaScript
Form Validation with JavaScript  I created a simple form including nine or ten fields in HTML, and i want to validate it in JavaScript. How can i do...;/script> <form name="form" method="post" onsubmit="return validate();"> <
login form validation - JSP-Servlet
login form validation  hi, how to validate the login form that contains user name and password using post method . the validation should not allow user to login in the address bar thanks regards, anand
Jquery form validation does not work
Jquery form validation does not work  I want to use jquery validation...;Have a look at the following link: JQuery Form Validation The above link provide you a good example of validating a form using jquery with illustration
Jquery form validation does not work
Jquery form validation does not work  I want to use jquery validation...;Have a look at the following link: JQuery Form Validation The above link provide you a good example of validating a form using jquery with illustration
Html form validation using jquery
Html form validation using jquery  Hi i am using form with html. Form elements like textbox, radio,checkbox,listbox i was used now how to validate the elements using submit jquery option
HTML form validation using jquery
HTML form validation using jquery  Is there any way for validating html elements common under a class by giving its class name in jquery validation code..that means validating all elements by using its class name if those
javascript form validation
javascript form validation  How to validate radio button , dropdown list and list box using onsubmit event..please give me a sample example..If we do...(); return false; } return true; } </SCRIPT> </HEAD> <form name="f1
Form validation Using Jquery Plugin
Form validation Using Jquery Plugin  Hello sir I want to implement form validation using JQuery Plug-in. My code is : <html> <style type...; } .form-row { padding: 10px 0; clear: both; width: 800px; } label.error { width
PHP JavaScript form Validation - PHP
PHP JavaScript form Validation  Just looking for a general PHP JavaScript form Validation. How can I write external JavaScript Validation? Please suggest!  Hi Friend, 1) form Enter Name Enter Address
Example of login form validation in struts2.2.1framework.
Example of login form validation in struts2.2.1 framework. In this example, we will introduce you to about the login form validation in struts2.2.1 framework. Our login form validation example does not validate the user against
ModuleNotFoundError: No module named 'django-tastypie-with-file-upload-and-model-form-validation'
-and-model-form-validation'  Hi, My Python program is throwing following...-and-model-form-validation' How to remove the ModuleNotFoundError: No module named 'django-tastypie-with-file-upload-and-model-form-validation'
ModuleNotFoundError: No module named 'django-tastypie-with-file-upload-and-model-form-validation'
-and-model-form-validation'  Hi, My Python program is throwing following...-and-model-form-validation' How to remove the ModuleNotFoundError: No module named 'django-tastypie-with-file-upload-and-model-form-validation'
Help needed for Form Validation please help!
Help needed for Form Validation please help!  I have created a page... to the login submit button. <html><form name=f1 method=POST action...='_blank';return true;"> Â Â </div> <form name=f2 method=POST
Please provide jquery inline form validation for the code
Please provide jquery inline form validation for the code   <html> <head> <meta http-equiv="Content-Type" content="text/html...="white"> <form action="Student1Servlet" method="post" enctype="multipart/form
Please Provide jquery inline form validation
Please Provide jquery inline form validation  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd...;/head> <body> <form action="LabAccountServlet" method="post"><
Form Validation With Java Script
Form Validation With Java Script   ... the Validation in  JavaScript and  your Validation in JavaScript program... information are entered to the users in the form fields before submission
Form validation using jQuery plug in & JSP
Form validation using jQuery plug in & JSP In this tutorial, we will discuss about form validation using jQuery plug in & display of submit content using JSP. In the given below example a form is given ,whose fields  like
validation
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
Javascript Form validation Example
Javascript Form validation Example In this section we will discuss about how... am giving a simple example for form validation using Javascript. ExampleADS..._TO_REPLACE_2 <html> <head> <title>Form Validation Example<
validation
validation  validation
form
form   Can I prevent a form from being submitted again
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
Form validation in javascript using jsf page  ?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional...; &lt;f:view&gt; &lt;h:form id="form2" onsubmit
validation
validation  please help me to check validation for <form> <table class="form"> <tr> <td class...; </table> <div style="text-align:center" class="form-buttons
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page  <p>?xml version='1.0' encoding...; &lt;f:view&gt; &lt;h:form id="form2" onsubmit="return
JSP Login Form with MySQL Database Connection and back end validation
Here we have created a simple login form using MySQL Database Connection and back end validation. We have also added a video tutorial of the program... database and matched with the input value given through the login form. Example
validation.....
validation.....  hi.......... thanks for ur reply for validation code. but i want a very simple code in java swings where user is allowed to enter only numerical values in textbox , if he enters string values then it should
validation
form using spring ,hibernate and jsp my all classes and jsp pages are pasted here when i try to validate my form its says invalid property'validater of ur...="ISO-8859-1"%> <%@ taglib uri="http://www.springframework.org/tags/form
validation
Validation method valid the in put. otherwise call the javascript onsubmit to check... code.Ok if you use struts then you can use Validation method valid the in put
Validation
javax.swing.*; import java.awt.event.*; class Form extends JFrame { JButton ADD; JPanel panel; JLabel label1,label2; final JTextField text1,text2;; Form...(panel); setTitle("FORM"); ADD.addActionListener(new ActionListener() { public void
Validation
); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel=new JPanel(); panel.add(scroll); JFrame frame=new JFrame("JTable validation
Validation
Validation  Here is my form and what code should i write for validating it? - <form action="test4.jsp"> <ul> <b>User ID</b> :<input type="text" name="userid">
Validation
Validation  Here is my form and what code should i write for validating it? - <form action="test4.jsp"> <ul> <b>User ID</b> :<input type="text" name="userid">
HTML form example
HTML form example In this section we will develop HTML form example and show you how to performance form validation using JavaScript. The HTML <form>... user and then validate it.  The HTML form is written in HTML markup
Login form and registration
Login form and registration  I need a complete code for ligin and new user registration form and validation
date validation
date validation  sir, pls provide date validation code in javascript..we want to include it into our master form..   Please visit the following link: http://www.roseindia.net/mysql/datevalidation.shtml
spring form field clearence
spring form field clearence  hi, I have spring form application in which i have security question and answer field for answer field validation after giving wrong format validation occurs but the field remains in that text field
JSF Form Validation
JSF Form Validation         ... about JSF. In this section on "JSF Form Validation" you will learn how to validate the JSF Form using tag libraries provided along with JSF 1.2
PHP Form Part-1
Topic : HTML FORM Part - 1  In this tutorial, we will learn how to deal with Html Form, JavaScript Validation, MySQL Database and PHP Scripts. We..._TO_REPLACE_1 Let's start with Html Form : If you have little bit  knowledge
yyyy-mm-dd validation in javascript
yyyy-mm-dd validation in javascript   My form return value like (2011-10-05)yyyy-mm-dd ... my End date greater than my start date.. How to do validation in javascript
validation files
validation files  If I place validation files in the folder where the action classes are present,will there any error arise
validation message - Struts
validation message  sir, i took help of that example but in that we change only color of the message i want to shift the place of the error message.means all messages are put together at top of the form

Ads