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.

 
 


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)      6 months and 22 days 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>
View Answers









Related Pages:
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
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
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
Load function ***PLEASE HELP
Load function ***PLEASE HELP   Hi I am writing a program that tracks... this done as this project is due on monday for me. My code right now looks..., remove players, save players, sort the list, or save it. I need to add another
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.
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
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
help please
thing i want to imp in my app.please any one have app of this imp pls send me war file.. Or atleast help me with code here.. I tried checking session alive...help please  hi i am done with register application using jsps
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
Alert in Servlet
of each row, when i click delete it shd alert me....This is my servlet code:<...;} [/code]</p> <p>Please help me.</p> <p>Thanks...Alert in Servlet  <p>Hi</p> <p>I want
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 - JSP-Servlet
please help   i am making a program by this i can find out the result for between years for any class. i have three combo box for class_name, from... To Year "> please help
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
Need urgent help with C++ errors!
Need urgent help with C++ errors!  hi, i'm new to C++ programming. this is my code... i'm using Turbo C++. It's showing so many errors!.. I don't know what to do. Please help!! #include<iostream.h> void main
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
Help Me in My Java Work
Help Me in My Java Work  Can you help me please... Write a Java application, to be called GpaCalculator, which will return a grade point average..., and then calculate the average grade point value for all the marks entered. The GPA points
Help With Costructing Selection sort?
Help With Costructing Selection sort?  Using a selection sort... in advance!   Please visit the following link: Java Selection Sort..., the second dimension's value, and the first dimension's value on a single line
Please Help - JSP-Servlet
,Let me try my hands on it.. The help i need is can u please tell me the procedure for how to bring my alert box in Home Page? Theoretical explaination..., in Home page. Then only u can get alert box in home page. Ur problem has
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
Help With My Java Project?
to put it all together to make it work. please help import...Help With My Java Project?  Write a console program that repeatedly... value on a single line separated by : (colon). display: Bubble Sorted using
java multiple users with single connection - JSP-Servlet
then it will also helpful for me. please help me out here, i will be pleased to you...java multiple users with single connection  hi, my problem.... i am precising my problem with help of example as yahoomail and gmail. both
Not sure whats wrong with my code HELP PLEASE?!?!
Not sure whats wrong with my code HELP PLEASE?!?!  I cant figure out what I am doing wrong in my code can anyone help me out??? Grades function computeGrade( ) { var hw, lab, midt, fin, avg; hw = parseFloat
Sort
Sort  Hi i would really be thankful if someone could help me with this A program is required to ask users to rate the Java programming language... all the votes have been counted, the program should output a table showing how
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
ajax code please help to solve this........
null; } please help me when i am running this it show an error...ajax code please help to solve this.  in this i am trying to get data from datbase and put it in combo box and then display it down using table
need help...................please
on this area. Please help me. By the way, I'm using access Database and JSP coding...need help...................please  I have a problem in my JSP Coding...("GET",url,true) xmlHttp.send(null) } else{ alert("Please Select Employee Id
Name Display in alert box - JSP-Servlet
Name Display in alert box  Dear Sir, Please any one help me... the alert box but the value is not in data base alert box is not display...?, ?no-cache?); if(isExist){ response.getWriter().write(?User Name exists. Please
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??
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
Display JSP selected listbox and checkbox in xml-please help me
Display JSP selected listbox and checkbox in xml-please help me  Hi, I have three Listbox on my jsp page. I want to do following: ByDefault first... as selected multiple checked checkboxes. Please help in this how to do this.....I am
Please help me fix this code - MobileApplications
Please help me fix this code   Please help me in this area of code... expenses)", "Please fill all required field \n \n * This signify required field... to display all the expenses for the selected trip. i want to use image
Please help me about maven2 plugin - Maven
Please help me about maven2 plugin  First, thanks you for your all... an error. I send you the image i capture the error Please help me... maven plugin. When i go to help/software update/ find and install/ search
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
Need help in constructing bubble sort
Need help in constructing bubble sort  using a bubble sort, for each... array figured out just couldnt dont know how to plug in the bubble sort..., the second dimension's value, and the first dimension's value on a single line separated
Struts2 Helloworld problem -Please help - Struts
. Please help me out in resolving this problem and provide me a pointer... problem I unable to execute the program successfully. Please find my example...Struts2 Helloworld problem -Please help  Hi I am a beginner
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
Compiler errors in java
Compiler errors in java  Hi, I used GenerateRDF java file. Am getting errors when i run this code. I used command prompt only. getting errors as no package exist. i followed your instructions properly. Please help me out
Unable to find Software Updates in Help menu in MyEclipse
to my eclipse. Can anyone please help me. Thanks, Suriya   Hi Suriya...Unable to find Software Updates in Help menu in MyEclipse  Hi, I am using MyEclipse for my project. I have to use SVN repository for checking
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
alert in jsp
alert message?, please give me a code how to write alert box in jsp... Password"); %> <script> alert("please enter old Password...alert in jsp  if(pass.equals(pwd)) { Statement st1
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
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
Unable to execute JSP page
folder. But I could not execute the JSP page. Please help me...Unable to execute JSP page  I have written one jsp file. It contains.... The tomcat server is already running onto my machine. I have saved the jsp file
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 with this code
Please help with this code  I need some help getting the Search method below to work with the menu, and I also cannot figure out how to get my bubble sort to work. I've spent a long time on this and think my brain is just fried
My screen EPAD is broken ...please help
My screen EPAD is broken ...please help   iam in iraq and my screen EPAD is broken ,.please help..can tel me a place to join it to solve this problem ?..Sory
Sort the element find mean
developing this program in java..Please help me to solve this problem ASAP...Sort the element find mean  Hi Friend, I want to find meaning... the mean of 314.48,309.11,398.98,318.64,377.44. Because my client want the mean

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.