JavaScript - Uk Telephone Number Validation Script
Hello All,
I am not too good with javascript so I apologise in advance! I have a website form where people input their contact details and I need a script which allows the form to be submitted if the telephone number is correct and returns an error if the number is invalid, (preferably in a pop-up box - not on another page) which says something like "The telephone number you have entered is invalid. Please enter a valid UK landline or mobile number". For the number to be valid, it has to either start with an "01", an "02" or an "07" and be either 10, or 11 digits long. The user should also be able to enter space without an error (ie, the script should ignore spaces). Any suggestions would be much appreciated. Regards, AC Similar TutorialsHello, I have the following code that, among other things, should validate US telephone numbers with format: "(800) 800-8000" with hyphen, parenthesis and spaces optional. The regexp is: /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/ My main problem is that it validates also numbers like 800 or 800000000000000 etc. The code works perfectly on test pages but not on my website. Something similar happens also for the zipcode. Can someone please tell me what could be wrong? Thanks! Code: (function($){ $.fn.ax_validate = function(f){ stopAnim(); // just too much otherwise //console.log(typeof f + ', id = ' + f.id); var n, el, err = [], msg = [], fmats = { 'email': /^[\w\.\-]+\x40[\w\.\-]+\.\w{2,4}$/, 'phone': /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/, 'zip': /^\d{5}(-\d{4})?$|[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d/ }; $('input[type=text],textarea').each(function(i){ $(this).val( $.trim($(this).val()) ); }); $('label.req').each(function(i){ n = $(this).attr('for'); el = $('input[name=' + n + ']'); if (typeof fmats[n] != 'undefined' && !el.val().match(fmats[n])) { err.push(n); msg.push($(this).text() + ((el.val() == '') ? '' : ' (invalid format)')); $(this).animate({color: '#A60'}, 1000); } else if (el.val() == '') { err.push(n); msg.push($(this).text()); $(this).animate({color: '#A00'}, 1000); } else { $(this).css('color', '#0f4068'); } }); if (err.length == 0) { //alert('All ok!'); //f.submit(); return true; } alert('<b>Please fix the following required fields:</b><br /><br />' + msg.join('<br />')); //$('input[name=' + err[0] + ']').focus(); return false; }; })(jQuery); I am trying to figure out how to make a random number I can plug into a script count down from that number at certain times of the day until it reaches 0. I would like it to reset itself at midnight every day. I'm trying to make it work with a script I found on here that resets itself at midnight every day. So instead of it counting down too fast, it would count down to the next number after a randomly generated number of minutes until it reaches 0. But it wouldn't necessarily have to end at 0 at midnight. It could go from 845 to 323 at the end of the day at a slower pace. Is that possible?
Hi there, I need to validate three textboxes and it will validate for numbers. How should I change my code to validate three textboxes? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Untitled Page</title> <script type='text/javascript' language="javascript"> var validPhoneChar = "+"; // Minimum no of digits in an international phone no. var minDigitsInPhoneNumber = 10; function isInteger(s) { var i; for (i = 0; i < s.length; i++) { // Check that current character is a number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag) { var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++) { // Check that current character isn't whitespace. var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function checkRequirements(strPhone) { if(strPhone.indexOf("+") > 1) return false; s = stripCharsInBag(strPhone,validPhoneChar); return (isInteger(s) && s.length >= minDigitsInPhoneNumber); } function ValidateForm() { var Phone = document.getElementById("Text1"); //var Phone1 = document.getElementById("Text23"); if ((Phone.value == null)||(Phone.value == "")) //if match failed { alert("Please Enter your Phone Number."); Phone.focus(); return false; } /*if ((Phone1.value == null)||(Phone1.value == "")) //if match failed { alert("Please Enter your Phone Number0."); Phone.focus(); return false; }*/ if (checkRequirements(Phone.value) == false) { alert("Please Enter a Valid Phone Number."); Phone.value = ""; Phone.focus(); return false; } else alert("YAY!"); return true; } function NotAllowSpace() { // Get the ASCII value of the key that the user entered var key = window.event.keyCode; // Verify if the key entered was a Space if ( key == 32 ) { // If it was, then dispose the key and continue with entry window.event.returnValue = null; alert("Invalid,Please check") } else // If it was not, then allow the entry to continue return; } </script> </head> <body> <label>Office Telephone:</label> <input id="Text1" type="text" onkeydown = "return (event.keyCode != 32)"/><br /> <input id="Button1" type="button" value="button" onclick="return ValidateForm();" /><br /> </body> </html> I need to use Javascript to validate 3 textboxes, whereby the users can only key in numbers (because they are phone numbers related fields). If any of the textbox is empty, display an alert message to show which textbox is empty. I do not want to show many alert messages to show that, for example, text1 and text2 are empty, it will show two alert messages. I would need to show one "summarized" alert message instead. Next, check if the textbox matches the pattern (which is to check if it has the skeleton of a phone number). If it is, show an alert message that it is alright. Else, show that it does not match. Need Phone Number Validation for my JavaScript, i can't work it out It currently has E-mail, Surname, Address and Name validation, This is my code at the moment: Code: <script language="JavaScript"> function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ alert("Please Enter a Valid E-mail") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Please Enter a Valid E-mail") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ alert("Please Enter a Valid E-mail") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Please Enter a Valid E-mail") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("Please Enter a Valid E-mail") return false } if (str.indexOf(dot,(lat+2))==-1){ alert("Please Enter a Valid E-mail") return false } if (str.indexOf(" ")!=-1){ alert("Please Enter a Valid E-mail") return false } return true } function validate_required(field,alerttxt) { with (field) { if (value==null||value=="") { alert(alerttxt);return false; } else { return true; } } } function validate_form(thisform) { with (thisform) { if (validate_required(Name,"Name must be filled out!")==false) {Name.focus();return false;} if (validate_required(Surname,"Surname must be filled out!")==false) {Surname.focus();return false;} if (validate_required(Country,"Address must be filled out!")==false) {Country.focus();return false;} } { var emailID=document.submitting.email if ((emailID.value==null)||(emailID.value=="")){ alert("Please Enter a Valid E-mail") emailID.focus() return false } if (echeck(emailID.value)==false){ emailID.value="" emailID.focus() return false } return true } } function verifyEmail(form) { checkEmail = form.email.value if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) {alert("You have entered an invalid email address. Please try again."); form.email.select(); return false; } else { form.method="get"; form.rel="nofollow" target="_self"; form.action="myscript.cgi"; form.submit(); } } </script> Code: <form action="submit.htm" onsubmit="return validate_form(this)" method="post" name="submitting"> <span class="style5">Select Plant: <form id="form1" name="form1" method="post" action=""> <label> <select name="Item" id="Item"> <option>OMGwoopwoop Plant</option> <option>I'm Blue Plant </option> <option>Anonymous Plant</option> <option>Rawr Plant</option> <option>Chicka Plant </option> <option>Fruitopola Plant</option> <option>Whitoe Plant</option> <option>Wukidoo Plant </option> </select> </label> </p> <p>Name:<span class="style1"> <input type="text" name="Name" size="30"> <br> <br> </span>Surname: <span class="style1"> <input type="text" name="Surname" size="30"> <br> <br> </span>Address:<span class="style1"> <input type="text" name="Country" size="30"> <br> <br> </span>Email:<span class="style1"> <input type="text" name="email" size="30"> <br></span></p> Phone Number:<span class="style1"> <input type="text" name="phone" size="30"> <form action="submit.htm" onSubmit="return validate_form(this)" method="post"> <input type="submit" value="Submit"> </form> Hi guys, I have written a double validation as below function validateDouble(ele){ // Custom trim funcation, i have written if(trim(ele.value) != ''){ var a = /^\d+(\.\d{0,2})?$/.test(trim(ele.value)); if(a){ return true; }else{ return false; } }else { ele.value = '0.00'; return true; } } I have copied from the net But this validation doesnt work when we enter the value as .65 (Means, it should accept this also, Please help me to change the regular expression) and in the same time when we enter this with out prefix, it should auto change to 0.65. Can some one help me to add in the above function. Hi! I wish to know if one can dynamically validate a textbox that accepts telephone numbers. I plan to do this by: first selecting a country form a dropdown box. then validate the text box for the corresponding country selected... but do not have any idea how to do it! can you help me ? I have a phone number field on my form that needs validation, but I'm not sure how to code this. I have the following function to validate a first name is entered and last name. The phone number field must match a 7 digit or 10 digit(with area code)phone number. I want to be able to include paranthese and/or hyphens for the valid phone number. function checkForm1() { if (document.forms[0].firstname.value.length == 0) { alert("You must put in a first name"); return false; } else if (document.forms[0].lastname.value.length == 0) { alert("You must put in a last name"); return false; } Hey there. Firstly, I am a total beginner to Javascript. I know basic HTML and some CSS, but Javascript seriously confuzzles me; even just basic stuff like calling functions. :S I've joint this forum in the hope of learning more about Javascript and how to use it properly, in terms of writing my own code, etc. My problem is this. I've come across this number-guessing script: Code: <script language="javascript" type="text/javascript"> var num = Math.floor(Math.random() * 100) + 1; var tries = 0; function Guess() { var g = document.form1.guess1.value; tries++; document.form1.tries.value = tries + "/10"; if (g < num) document.form1.hint.value = "Nope, try guessing higher."; if (g > num) document.form1.hint.value = "Nope, try guessing lower."; if (g == num) { window.alert("Correct! Congratulations, you guessed it in " + tries + " tries."); location.reload(); } if (tries == 10) { window.alert("Sorry, you've ran out of guesses! The number was " + num + "."); location.reload(); } } </script> ... which I love. I understand the basics of it. However, I want to try and improve on it. For example, I'd like to implement a Give Up button, so that when you press this button the script reveals the number for you instead (in an alert message) and when this alert message clears, the page is automatically reloaded/cleared and a new game begins. Suggestions, also, for how it can be improved and how I can go about doing it, are much appreciated. I know it may be a lot to ask, but I am seriously in need of help. Here is the HTML by the way: Code: <html> <body> <h1>Guess The Number</h1> <hr/> <p>I'm thinking of a number between 1 and 100. Try to guess it, but be warned - you only have 10 tries!</p> <form name="form1"> <b>Guess:</b> <input type="text" name="guess1" size="5" maxlength="3"/> <input type="button" value="Guess" onclick="Guess();"/> <br/> <input type="text" size="25" name="hint" disabled="disabled"/> <br/> <b>Tries Used:</b> <input type="text" size="4" name="tries" disabled="disabled"/> <br/> </form> </body> </html> I have a website that uses a php contact form with recaptcha, I would like to add a javascript for the validation of the form. How would I refer to the form? I have this in my form code. Is that enough? or do I have to add an event handler or something else, also do I need to specify a path or will it just go to validate.js? New to Javascript Code: <form id="form" action="process.php" enctype="multipart/form-data" method="post" name="form_to_email" onsubmit="return Validate();"> I am trying to design a webpage but no matter how i design it, IE seems to show totally different design then firefox/chrome/safari. Is there any website i can goto which will take my CSS/Script input and give me the IE version of it so it can work on all browsers without any issue? Thanx Hi Guys, Im new to JS and need some help.. I have a contact form on my webpage and i want to put in an alert box if people done enter a field. Below is the html i have for the form PHP Code: <form id="form" method="post" action="consultation.php" onsubmit="return validate(this)"> <p> <label>Name:</label> <input type="text" name="name" id="name" /> </p> <p> <label>Company:</label> <input type="text" name="company" id="company" /> </p> <p> <label>Email:</label> <input type="text" name="email" id="email" /> </p> <p> <label>Phone:</label> <input type="text" name="phone" id="phone"/> </p> <p style="margin-bottom:0px"> <input class="submit_btn" type="image" src="images/submit_btn.gif" name="submit" value="Submit" /> </p> </form> and here is the external Java Script file that iv made so far PHP Code: var nName = nForm['name']; var nCompany = nForm['company']; var nEmail = nForm['email']; var nPhone = nForm['phone']; if (nName.value.replace(/s/g, "").length < 1) { alert('Please enter your full name'); return false; } if (nCompany.value.replace(/s/g, "").length < 1) { alert('Please enter your company name'); return false; } if (!/^w+[w|.|-]{0,1}w*[w|.|-]{0,1}w*@w+[w|-]{0,1}w*[w|-]{0,1}w*.{1,1}[a-z]{2,4}$/.test(nEmail.value)) { alert('Please enter your correct email address'); return false; } if (!/[ds-]+$/.test(nPhone.value) || !/d{10}/.test(nMobile.value.replace(/[s-]/g, ""))) // must contain 10 digits; { alert('Please enter your correct phone number'); return false; } iv referenced this Java script file in the head of the html document.. Can anyone help me make this script please... THanks I have two seperate js files. One that houses the functions mylibrary.js and another that call the validated functions myform.js. I can not get the form to validate any data. The data just sits there and will not report errors. Any help would be greatly appreciated. Code: function valForm() { if(!isAlpha(document.myform.firstname.value)) { myform.firstname.focus(); return false; } if(!validEmail(document.myform.email.value)) { myform.email.focus(); return false; } if(!isRequired1(document.myform.options.value)) { myform.options.focus(); return false; } return true; } // JavaScript Document seperate js file mylibrary.js function isNumber(num) { return !(/\D/.test(num)); } function isAlpha(text){ return text.match(/\w+/) } function validEmail(email){ return email.match(/^([a-zA-Z0-9]{3,})(((\.|\-|\_)[a-zA-Z0-9]{2,})+)?@([a-z]{3,})(\-[a-z0-9]{3,})?(\.[a-z]{2,})+$/i ) } function isRequired1(){ if(myform.food.selectedIndex ==0) { alert("Please select from the drop-down list."); } } I wanted to make it so that a button on the webpage validates a word that a user types into a prompt box that pops up when they open the webpage. For example, user goes on website, prompt box opens, user types in word then presses OK. On the webpage he clicks the button, which calls a while function to check if the word has a P at the start, a J somewhere in it, and is longer than 8 characters. Code: <script type="text/javascript"> var strWord; function validateWord() { while(strWord == document.formname.validateWord.value.length > 8 && var iChars = "JP";) { "alert(Correct)" value="Word Alert"> } } </SCRIPT> I've been trying this script but with no luck and cant tell whats wrong with it. Any ideas? Having an unusual problem with the simple validation script below. In my script, I want to validate the username text field so that if the value of the text field (i.e. the amount of characters in the field) is less than 5, it would show a message in the page using innerHTML. The script works, but in a roundabout sort of way, or at least that's what it seems to me. Instead of making sure that the amount of characters in the text field is less than 5, it seems to disregard this entirely and instead make it so that if it has no value at all, the message will be shown. If it has a value of even 1 character, though, the message does not show. Not what I was trying to do, and I really don't know what's happened. Thanks in advance to anyone who can help out a newbie in need. Code: function uservalidate() { if (document.getElementById("user").value < 5) { document.getElementById("userdiv").innerHTML = "Username must be six characters or more." } else { document.getElementById("userdiv").innerHTML = "" } } Code: <body> <form id="form1"> <input type="text" id="user" onblur="uservalidate()" /> <div id="userdiv"></div> </form> </body> </html> Hi there, I'm fairly new to Javascript, though have a good deal of experience with C# and HTML. I am having trouble getting a form to validate when it is submitted. My goal is that if a checkbox is checked (allowing the user to request more information via email) that the email address textbox should also verified to be filled out. What I have is a script in the page body, that (I believe) validates the two form elements, and the form has an onsubmit tag to run the javascript. However, everytime I run a test on the page, it submits regardless of if there is or isn't anything in the email field, with the box checked. Any guidance would be appreciated! Code: <script type="text/javascript"> function validate(){ if(document.getElementById('00N50000002tarI').value == '1' && document.getElementById('email').value == ''){ alert('Please enter your email address'); return false; } </script> <form class="apply_now_form" action="test.php" id="apply_now_form" method="POST" onsubmit="return validate();"> <div class="text"><label for="email">Email</label> <input id="email" type="text" name="email" maxlength="80" /></div> <div class="check"><font color="#006e92"><input id="00N50000002tarI" name="00N50000002tarI" type="checkbox" value="1" />*I would like to receive the latest updates via email.</font><br></div> <div class="submit"><input class="c pill-button" type="submit" name="submit" value="Apply Now!"/></div> </form> Note: This form was generated by SalesForce Web-to-lead, so I cannot modify form field names, and the form is running on WordPress, in an blank page template (so there shouldn't be any WordPress code muddling with the form). This may seem a long shot, but 5 years ago I found a script that had everything (not just alpha, etc, but everything). I have looked at Jquery validation and while it is robust, many of the examples were bugged. I am no coder, and I feel like I may be torched here for wasting precious space. However, I was really hoping you all could point me in a right direction. Perhaps if not java, with something else. Paid, Donate, Free. Anything. (The only script I have on form now is just Auotab next/prev plugin for jquery) Function required: Inline on change/next type matching (confirm email/pw fields) basic formatting (numeric only, alpha with spaces, etc) Basic validation of email type expressions, etc Required fields, etc However, I would love to take it a step further Email: Checks for valid TLD Password: sctricter requirements Phone: Requires legitimate values (not just numeric); ie: 201-999, no 555, 411,611,911, etc Date of birth: Checks valid ranges of dates entered; checks min/max age requirement Possible real time database or web services checks (which would be ajax, etc im sure) custom number values (ie, for credit cards, number must be xxxx-xxxx (not 0000-1111-2222-3333 Any other possible logical info, for instance, Name not in badnames list (like Fred Flinstone, IP Freely, or other Cuss words/phrases) Yes, I know most of these would wind up as a server side reject on the submit page, where we could possibly recapture the data. However, that type of method typically lowers conversions. Yes, there is the Jquery plugin, and with knowhow, you can make it do this, however I dont have the knowhow and would rather donate/pay for something already out of the box. The use for this would be contact forms, profile forms, info requests, sales pages, "<scr'+'ipt type="text/javascript" src="js/val_feedback_Email.js<\/scr'+'ipt>" How should I call the js validation script for a feedback form that was document.written in a pop up? I have a page which contains a button. Onclick it produces a pop up window that contains a small feedback form produced by document.write. This much works. NOW I need to call the js validate script but nothing seems to work I tried this is the head of the page <script type="text/javascript" src="js/val_feedback_Email.js"> I tried this is the head of the doumnet.write part "<scr'+'ipt type="text/javascript" src="js/val_feedback_Email.js<\/scr'+'ipt>" How do I call the js script to validate the form in the pop up? Where if anywhere should it go? I'm stumped Any and all ideas welcomed LT THis is the start of my script Code: <script type="text/javascript"> var newWindow; function subWrite() { newWindow = window.open("","","status,height=500,width=700") //bring subwindow to front newWindow.focus(); //assemble content for new window var newContent = '<html><head><title>ACES UK. Send us your Email</title>'; newContent += '</head><body>'; newContent += '<form action="feedback.php" method="post" name="feedback_1" id="feedback_1" onsubmit="return validate(this.form)"'; I am trying to implement a credit card check function in the validation script. But whenever i enable the function it bypasses all previous validation checks and just inputs the data, where am i going wrong with this function? Code: function CheckCreditCard(cardtype, cardnumber) { var frm = document.forms["OrderForm"]; if (cardtype == "Visa") { var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/; } else if (cardtype == "Master Card") { var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/; } else if (cardtype == "American Express") { var re = /^3[4,7]\d{13}$/; } if (!re.test(cardnumber)) return false; cardnumber = cardnumber.split("-").join(""); var checksum = 0; for (var i=(2-(cardnumber.length % 2)); i<=cardnumber.length; i+=2) { checksum += parseInt(cardnumber.charAt(i-1)); } for (var i=(cardnumber.length % 2) + 1; i<cardnumber.length; i+=2) { var digit = parseInt(cardnumber.charAt(i-1)) * 2; if (digit < 10) { checksum += digit; } else { checksum += (digit-9); } } if ((checksum % 10) == 0) return true; else sfm_show_error_msg('error message goes here'); return false; } HTML Code is: Code: <script language="JavaScript" type="text/javascript"> var frmvalidator = new Validator("OrderForm"); frmvalidator.EnableOnPageErrorDisplaySingleBox(); frmvalidator.EnableMsgsTogether(); frmvalidator.EnableFocusOnError(false); // other attributes went here but were removed frmvalidator.setAddnlValidationFunction("CheckCreditCard"); </script> FULL Javascript: Attached at a txt file, was too large to post here. Hi coders, I have a form where customers can register thierselves by entering the relevant fields. There is a control() javascript which ckecks if everything on the form is ok before submitting it. Althugh IE applies the script for its every check, Firefox only applies the first check (first if statement) of the script. The rest is ignored. Here is the javascript code: Code: function control() { if (document.member.FirstName.value == ""){ document.member.FirstName.focus(); alert("Please fill the name field"); return false; } if (document.member.FirstName.value.length<2) { alert("Name field cannot be shorter than 2 characters."); document.member.FirstName.focus(); return false; } if (/[\d]/.test(document.getElementById("FirstName").value)) { alert("Entered numbers into the Name field"); return false; } if (document.member.LastName.value == ""){ document.member.LastName.focus(); alert("Please fill the Lastname field"); return false; } if (document.member.LastName.value.length<2) { alert("Lastname field cannot be shorter than 2 charcters. Please check again."); document.member.LastName.focus(); return false; } if (/[\d]/.test(document.getElementById("LastName").value)) { alert("Entered numbers into the Lastname field"); return false; } if (document.member.Address1.value.length<10) { alert("Address field contains less than 2 characters."); document.member.Address1.focus(); return false; } if (document.member.Username.value == ""){ document.member.Username.focus(); alert("Username field cannot be blank"); return false; } if (document.member.Address1.value == ""){ document.member.Address1.focus(); alert("Address field cannot be blank "); return false; } if (document.member.City.value == ""){ document.member.City.focus(); alert("City field cannot be blank"); return false; } if (document.member.Email.value == ""){ document.member.Email.focus(); alert("E-Mail field cannot be blank."); return false; } if (echeck(document.member.Email.value)==false){ document.member.Email.focus(); return false; } if (document.member.PhoneNumber.value == ""){ document.member.PhoneNumber.focus(); alert("Phone number field cannot be blank"); return false; } if (!/^\d*$/.test(document.getElementById("PhoneNumber").value)) { alert("Entered characters into the Phone Number field"); return false; } if (document.member.Pass.value == ""){ document.member.Pass.focus(); alert("Password field cannot be blank."); return false; } if (document.member.Pass2.value == ""){ document.member.Pass2.focus(); alert("Password confirmation field cannot be blank."); return false; } if (document.forms[0].Pass.value.length<6) { alert("Password field cannot contain less than 6 characters. Please check"); document.member.Pass.focus(); return false; } if (document.member.Pass.value != document.member.Pass2.value) { alert("Password and password confirmation fields are not identical. Please check "); document.member.Pass.focus(); return false; } if (!isTelNum(document.forms[0].PhoneNumber,'Telefon ')) return false; if (!isNum(document.forms[0].InternalPhoneNumber,'Internal Phone number')) return false; //if (!isValidEmail(document.forms[0].Email)) return false; return true; } Well its interesting that only the first check is taken into consideration. if (document.member.FirstName.value == ""){ The rest is not even seen. Even if you do not fill the rest of the form, the submit button tries to submit the form regardless what more needs to be checked. Here is the submit button: Code: <input type="submit" name="member" value="Register Me" id="member" onclick="return control()";> Any observations and comments are appreciated. |