i want validation for one text field and text area,email,combobox, in that email will validte by useing regular expressions?

i want validation for one text field and text area,email,combobox, in that email will validte by useing regular expressions?

i want validation for one text field and text area,email,combobox, in that email will validte by useing regular expressions?

View Answers

October 19, 2011 at 4:13 PM

<html>
    <h2>Form Validation</h2>
        <script language = "Javascript">
          function checkEmail() {
            if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value)){
            return true;
            }
            return false; 
          }
          function checkName(str){
              var re = /[^a-zA-Z]/g
              if (re.test(str)) return false;
              return true;
            }
            function checkAddress(str){
              var re = /[^[a-z][A-Z][0-9]]/g
              if (re.test(str)) return false;
              return true;
            }
          function validate(){
            var emailID=document.form.email;
              var nn=document.form.name;
                var add=document.form.address;

            if ((nn.value==null)||(nn.value=="")){
            alert("Please Enter your Name!")
            nn.focus()
            return false
            }
            if (checkName(nn.value)==false){
            nn.value=""
            alert("Invalid Name!");
            nn.focus()
            return false
            }
            if ((emailID.value==null)||(emailID.value=="")){
            alert("Please Enter your Email ID!")
            emailID.focus()
            return false
            }
            if (checkEmail(emailID.value)==false){
            emailID.value=""
            alert("Invalid Email Adderess!");
            emailID.focus()
            return false
            }
            if ((add.value==null)||(add.value=="")){
            alert("Please Enter your Address!")
            add.focus()
            return false
            }
            if (checkAddress(add.value)==false){
            add.value=""
            alert("Invalid Adderess!");
            add.focus()
            return false
            }
            if(document.form.qua.selectedIndex==""){
            alert ( "Please select your qualification!" );
     return false;  
    }
            return true
          }
        </script>
        <form name="form" method="post" onSubmit="return validate()">
        <pre>
        Enter Name:              <input type="text" name="name" size="30"><br>
        Enter an Email Address : <input type="text" name="email" size="30"><br>
        Enter Address            <textarea name="address" rows="5" cols="23"></textarea><br>
        Select Qualification:    <select name="qua">
                                 <option value="BTech">BTech</option>
                                 <option value="MBBS">MBBS</option>
                                 <option value="MBA">MBA</option>
                                 <option value="MCA">MCA</option>
                                 </select><br>

        <input type="submit" name="Submit" value="Submit">
        </pre>
        </form>
</html>









Related Tutorials/Questions & Answers:
i want validation for one text field and text area,email,combobox, in that email will validte by useing regular expressions?
text field validation - Java Beginners
Advertisements
Can i insert image into struts text field
How to Define Text Field Validation iPhone
File format validation and text field validation in java swings
iPhone Text Field Validation
i want image upload and download useing STRUTS 1.2 version example..
text field
CALULATION IN TEXT FIELD
converting field to text sql
swing text field problem
swing text field problem
Text Field in HTML
validate text field iPhone
clearing text field in spring form
jsf text field not blank
rich text field - JSP-Servlet
how to move curosr from one text field to another automatically when the first textfield reaches its maximum length
how can retrieve more than one values in text field using ajax?
I need jsp code for how to write text field value into property file.
Capturing Text in a Group in a Regular Expression
Digit Only text field
Text field save as word file
JSP combo and text field related questio
iPhone Text Field Border 
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.
focus text field - Swing AWT
focus text field - Swing AWT
retrive record from the text field and insert into to database
ModuleNotFoundError: No module named 'django-storage-text-field'
ModuleNotFoundError: No module named 'django-short-text-field'
ModuleNotFoundError: No module named 'django-storage-text-field'
regarding out put display in html text field
This code send email two times but i want only once
This code send email two times but i want only once
regular expression expalanation i need
set text field appearance to default - Java Beginners
i have one txt field and one button.when i entere any test in testfield then only button should be enabled.
fetch values from database into text field
fetch values from database into text field
Text File I/O - DVD.java - Java Beginners
instead of text boxe i have to show check box as selected.
javascript cal code for selecting date in text field - JSP-Servlet
email validation
email validation
gradient text, text effect, text
Use of Text Field
how to highlight the field in image,when i have entered into that corresponding field's textbox-any one help out
text limitations
jQuery email validation

Ads