Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions 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.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


satyavarapu lavanya
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.
0 Answer(s)      a year and 10 months ago
Posted in : JavaScript Questions


    <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:hummdedum@felloff.com" 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>

Advertisement
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
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
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
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 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
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 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
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
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
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
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.  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
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
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
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
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.  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.  Please send me a code of template in opencms and its procedure.so i can implement the code. Thanks trinath
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.  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
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
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
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.
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 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
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
 

 

 

DMCA.com