this is my javascriptcode for dispalaying all errors in a single alert box,but unable to resolve it,please help me to sort out this.

this is my javascriptcode for dispalaying all errors in a single alert box,but unable to resolve it,please help me to sort out this.

    <html>
        <script>
        function isFormValid() 
    {   
        var userF = document.getElementById('FName').value;
        var userL = document.getElementById('LName').value;
        var userPW = document.getElementById('pw').value;
        var userPW2 = document.getElementById('pw2').value;
        var userEmail = document.getElementById('email').value;
        var userMobile=document.getElementById('mobile').value;
        var userAddress=document.getElementById('address1').value;
        var userCity=document.getElementById('city').value;
        var userState=document.getElementById('state').value;
        var userZip=document.getElementById('zip').value;
        var gen=document.form.radios;
        var NameFormat = /^[A-Za-z]{2,12}$/;
        var PWFormat = /^[A-Za-z0-9{6,12}$]/;
        var Mobileformat=/^[0-9]{10}$/;
        var Emailformat=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
        var retVal = true;
        var errorMsg = "";

        if (!NameFormat.test(userF))
            {
            errorMsg = "First Name is required and should only have letters. 2-12 letters max\n";
            retVal = false;
            }
        if (!NameFormat.test(userL))
            {
            errorMsg = errorMsg + "Last Name is required and should only have letters. 2-12 letters max\n"; 
            retVal = false;
            }

        if ( (gen[0].checked == false ) && ( gen[1].checked == false ) ){
            errorMsg=errorMsg+"please check your gender: Female or Male\n";

            return retVal =false;
            }
        if(!Mobileformat.test(userMobile)){

            errorMsg = errorMsg+"Mobile number is required and should only have 10 numbers \n";
            retVal = false;
        }
        if(!Emailformat.test(userEmail)){

            errorMsg = errorMsg+"please eneter a valid email id \n";
            retVal = false;
        }
        if (!PWFormat.test(userPW))
            {
            errorMsg = errorMsg + "Password is required and should only have letters and numbers. 6-12 letters max\n";
            retVal = false;
            }
        if (userPW != userPW2)
            {
            errorMsg = errorMsg + "Passwords do not match.\n";
            retVal = false;
            }
        if(!PWformat.test(userAddress)){
            errorMsg = errorMsg + "please enter valid address \n";
            retVal = false;

        }       
        if(userCity.value==""){
               errorMsg=errorMsg+"please enter your city\n";

            return retVal =false;
            }    
            if(state.value==""){
            errorMsg=errorMsg+"please enter your state\n";
            return retVal =false;
            }   
            if( zip.value == "" || isNaN(zip.value ) ||zip.value.length != 6 ){
            errorMsg=errorMsg+"Please provide a zip in the format ######.\n";

            return retVal =false;
            }
        if (!retVal)
            {
            alert( errorMsg);
            }
        return retVal;
    }
        </script>


    <form action="mailto:[email protected]" method="post" name="form" onSubmit="return isFormValid();">

    * First Name: <input type="text"  name="FName" id="FName" onblur="checkFName();"/><label id="labelFName"></label><br />

    * Last Name: <input type="text" name="LName" id="LName" onblur="checkLName();"/><label id="labelLName"></label><br />

    * Gender<input type="radio" name="radios" value="male" id="gen" onblur="checkgen();">Male <input type="radio" name="radios" value="Female">Female<label id="labelGender"></label><br />

    * E-Mail: <input type="text" id="email" name="Email" onblur="checkEmail();"/><label id="labelEmail"></label><br />

    * Mobile Number<input type="text" name="mobilenumber" id="mobile" onblur="checkmobile();"><label id="labelMobile"></label><br />

    * Password: <input type="password" id="pw" name="Password" onblur="checkpw();"/><label id="labelpw"></label><br />

    *Re-type Password: <input type="password" name="2Password" id="pw2" onblur="checkpw2();" /><label id="labelpw2"></label><br />

    * Address1<input type="text" name="address" id="addressid1" onblur="checkaddress1();"><label id="labelAddress1"></label><br />

    Address2<input type="text" name="add2"><label id="labelAddress2"></label><br />

    Address3<input type="text" name="add3"><label id="labelAddress3"></label><br />

    *City<input type="text" name="cityname" id="city" onblur="checkcity();"><label id="labelCity"></label><br />

    *State<input type="text" name="statename" id="state" onblur="checkstate();"><label id="labelState"></label><br />

    *ZIP<input type="text" name="zip1" id="zip" onblur="checkzip();"><label id="labelZip"></label><br />

        <input type="submit" value="Submit" />
        <input type="reset" value="reset" />

    </form>
    </html>
View Answers









Related Tutorials/Questions & Answers:
Please help me out
Please help me out    Description* You are hired to develop a laptop inventory information system for Sheridan College in order to keep track of the information about the laptops lent to the students. Users can add or remove data
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my... in the file. Also it should be displayed on the screen. However my code doesn't display the anagram on screen or the output file! Please show me whats wrong. Thanks i
Advertisements
Help me please with my final homework
Help me please with my final homework  Write a Java program of your choice that demonstrates the following concepts: ? Input and Output. ? Selection/Conditional (e.g. if statement). ? Arithmetic. ? Loops. ? Arrays
Getting Exception on UseDefinedException sample program - Please help me how to resolve
Getting Exception on UseDefinedException sample program - Please help me how...(); } catch(MyException ee1){ System.out.println("my ex"+ee1...(test1.java:34) what is MyException and how it called ..please explain
this is my javascript code and i am not understanding the mistake in this,please help me?
in this,please help me?  <html> <h2>Form Validation</h2>...; if((nn1.value==null)||(nn1.value=="")){ alert("Please Enter...=="")){ alert("Please Enter your Email ID
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx  Write a program that will print out a hydro bill. The bill will be formatted as the example on the next page. The following information
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx  Write a program that will print out a hydro bill. The bill will be formatted as the example on the next page. The following information
please help me.
please help me.  I have a jsp page under that i add a list box under i get the countries through my database. so how can i do
PLEASE HELP WITH MY JAVA
PLEASE HELP WITH MY JAVA  Hey my name is Gavin and im a student at school that takes IT. my teacher has gave me a problem and i can't figure it out please help!!!!!!!! it is a for-loop question: Display the first 5 multiples
please please i wanna insertion sort program find calendar to array value (1000,5000,10000), please help me
Insertion sort program find calendar to array value 1000,5000,10000  program find calendar for insertion sort in jfram to array 1000
I really need help with this assignment question Please help me out Please
I really need help with this assignment question Please help me out Please  * Description* You are hired to develop a laptop inventory information system for Sheridan College in order to keep track of the information about
Please help me to modify my java code from php code
]; } } I tried like this (see below JSP code) ... but this is not giving me the exact result as the above PHP code is giving. So please help me to convert
Please help me to modify my java code from php code
Please help me to modify my java code from php code  i want to covert... same, as they alter it before. Please help me on this topic "how to order rows...) ... but this is not giving me the exact result as the above PHP code is giving. So please
help me please
help me please   Hello I want helping for this question , Please Write a program that reads some friendsââ?¬â?¢ names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
please help me.
please help me.  Please send me a code of template in opencms and its procedure.so i can implement the code. Thanks trinath
please help me.
please help me.  How to read a properties file in java with a suitable example. Please send me. Thanks Trinath   Please visit the following link: Java read properties file
help me out...!!!!
help me out...!!!!  i have to make a project on console based application in java.. so can anyone guide me with some gd ideas that can be implemented
urgent...pleAse help me.....please!
urgent...pleAse help me.....please!  please help me urgent! how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
please help me.
please help me.  Please send me the validation of this below link. the link is http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html Thanks Trinath
please help me.
please help me.  I have three table in mysql,and i hava create a excel sheet and add this sheet.but my question is in every sheet i can display one one table result.how can i do
please help me.
please help me.  How to move the edits.jsp in below link? http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html
please help me
please help me  how to use two browse buttons, one browse button for displaying the first image and second for the second image along with its file... within a single frame
please help me
please help me  how to use two browse buttons, one browse button for displaying the first image and second for the second image along with its file... within a single frame
Help please, some strange errors
is causing that run-time errors? Any kind of help will be helpful to me. and let...Help please, some strange errors  Sorry about this messy formatting... this errors so i have posted the whole program here. Here i tried to make the monopoly
please help me
before. This name list should get from the database. Please help me. By the way, I'm...please help me  Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another
Please help me.
Please help me.  Hi i am trinath in below there is a url.In that url there is a code of edit a jsp page.I understand that code but only one thing i not get it i.e; What is the work of "id".and what is the data type of id? http
please help me...
please help me...  write an application that print number in the following order using a FOR-Loop 1 2 3 4 5 2 4 6 8 10 3 6 9 1215 4 8 121620 5 10152025
please help me in these prog
please help me in these prog   create 2 jdbc programs including awt create 2 jdbc programs including swing create 2 jdbc programs including command line argument create 2 jdbc programs including io class 4 jdbc prog using
please help me to this problem..
please help me to this problem..  i wrote a program like keyboard... inside the JTextField) but i want to make this program to let me write where i clicked (i.e allows me to write any thing at the field where i clicked
to all Experts.. please help me. im using a Jcreator. - Java Beginners
to all Experts.. please help me. im using a Jcreator.  3. Write a program that asks the user to enter a word. The program will then repeat word for as many times as it has characters: Enter a word: ILOVEU ILOVEU
need to fix errors please help
need to fix errors please help  it does have 2 errors what should i...; String name2; System.out.println("please enter your name:"); name1= input.readline(); System.out.println("please enter your friend's name:"); name2
Please help me
Please help me  Hi Sir, please send me the code for the following progrems... 1) all sets are integer type: input: set1={10,20,30,40} set2={15,25,35} output: union={10,15,20,25,30,35,40} 2) input: "Hi what
please help me here
please help me here  please show me how can this show the right output that i need please continue doing this program using only if else and do while please please" here is the problem Automatic Teller Machine [B] Balance [D
please help me here
please help me here  please show me how can this show the right output that i need please continue doing this program using only if else and do while please please" here is the problem Automatic Teller Machine [B] Balance [D
Please help me urgent...........
Please help me urgent...........  For what kind of a problem would use a Tree Set and not a Tree Map For what kind of a problem would use a Tree Map and not a Tree Set   Hello Friend,ADS_TO_REPLACE_1 If you want
Please help me??
Please help me??  Question_1: Using one-dimension array of primitive type elements. Objective: The purpose of this lab exercise is to practice how... respectively 7. Print all elements in both array1and array2 Question_2
I want to update the multiple values of database depending on checkbox..? Please help me out..
I want to update the multiple values of database depending on checkbox..? Please help me out..   Hi .. I want to Update the multiple values.....? please answer if any one knows as soon as possible..? Thanks in Advance
Please help me
Please help me  program for when a user enter his card number, it has to create default security pin in the database
please help me
please help me  interface Test1 { String toString(); } public class Test { public static void main(String[] args) { System.out.println(new Test1() { public String toString() { return "test
please help me?
please help me?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
help me please
help me please  how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
A few questions related to developing a blog....can anyone please help me out??
A few questions related to developing a blog....can anyone please help me out... jsp.I have a few questions.... Can anyone tell me if we can insert images... attribute"),will I get all the contents included in the textarea in the previous
Please help me to learn - WebSevices
Please help me to learn  Please help me to learn Java Fast
verify the code and give me the code with out errors
clear the errors and give me correct tutorial for my knowledge improving.pls anyone help me. E:\>java add java.lang.NullPointerException at add...verify the code and give me the code with out errors   import
please help me to overcome this problem
please help me to overcome this problem  how to make it easy to write java code. can u please give me suggestions
Please Help To Solve My Problem
Please Help To Solve My Problem  PHP I Have 6 Textbox and 1 ok...) When I Add This Six Team Name In Six Text Box Then I Will Click On Ok Button... automatically. On Match Schedule Each Team Play Only One Match With All Team When One Team
HQL Statement: Please help me
= Product.productGroupVersionId and Product.lobId = ? Can you please help me equallent HQL...HQL Statement: Please help me  Select ProductFamily.* from ProductFamily, ProductGroup, Product where ProductFamily.productFamilyVersionId
Begineer in coding please help me
; int pincode; } how to use this Address data type in my Person class to set address to a person object.. please help me...Begineer in coding please help me  I have Person class{ int pid
Coding errors for printing function, please help
Coding errors for printing function, please help  Hello, We, my.... Can someone please take a look and help me to fix this. Although...; Please visit the following link: http://www.roseindia.net/java/example/java
Please help me understand this query
Please help me understand this query  Hi, Could someone please help me understand the following query. Im finding difficulty relating it :-( Pls Help! select * from cbpartner where CBPartner.IsSummary='N' and salesrep_id

Ads