function isName(msg) { var str = document.form1.username.value; if((str.substring(0,1)<"a" || str.substring(0,1)>"z") && (str.substring(0,1)<"A" || str.substring(0,1)>"Z")) { msg = msg + "The Username should begin with an alphabetic character.\n"; } for (var i = 1; i < str.length; i++) { var ch = str.substring(i, i + 1); if ( ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && (ch < "0" || "9" < ch) && (ch != '_') && (ch != '.')) { var flag = 1; } } if (flag == 1) { msg = msg + "\nThe Username field accepts letters, numbers & underscore. No Spaces, just one word.\nPlease re-enter your Username Name.\n\n"; document.form1.username.select(); document.form1.username.focus(); } return msg; } function validate() { var msg = ""; msg = isName(msg); if (document.form1.username.value == "") { msg=msg + "Username\n";} if (document.form1.password.value == "") { msg=msg + "Password\n";} if (document.form1.password2.value == "") { msg=msg + "Retype\n";} if (document.form1.name.value == "") { msg=msg + "Name\n";} if (document.form1.email.value == "") { msg=msg + "Email\n";} if (document.form1.address.value == "") { msg=msg + "Address\n";} if (document.form1.city.value == "") { msg=msg + "City\n";} if (document.form1.state.value == "") { msg=msg + "State\n";} if (document.form1.pin.value == "") { msg=msg + "Pin\n";} if (document.form1.country.value == "") { msg=msg + "Country\n";} if (document.form1.telephone.value == "") { msg=msg + "Telephone\n";} if (document.form1.password.value != document.form1.password2.value) { msg=msg+"\n Retyped password has to be same as password \n\n"; } if (msg != "") { msg = "Please fill in the following fields correctly\n\n"+msg; alert(msg); } else { document.form1.submit(); } }