Revlet Posted May 19, 2009 Author Share Posted May 19, 2009 OH, my bad. Feel free to call me stupid. var frm_err = document.getElementbyId("form_errors"); function validateForm (frm) { var errors = [], errno = 0; if (!/^[a-z]+$/i.test(frm.Name.value)) errors[errno++] = "Name is required and can only contain letters."; if (!/^[a-z\d]+$/i.test(frm.Title.value)) errors[errno++] = "Title is required and can only contain letters and numbers."; if (!/^[a-z\d]+$/i.test(frm.Company.value)) errors[errno++] = "Company is required and can only contain letters and numbers."; if (!/^[-.+_\da-z]+@[-.\da-z]+\.[a-z]{2,4}$/.test(frm.Email.value)) errors[errno++] = "Email is required."; if (errno == 0) return true; frm_err.style.display = "block"; frm_err.innerHTML = "<ul><li>" + errors.join("</li><li>") + "</li></ul>"; return false; } Now the code simply doesn't validate... Just lets blank fields through Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 Oh, I misspelled document.getElementById. You can fix that. And FYI, there was an error. Unlike PHP, you just don't see it on the page. It's like a HTML error. It didn't make a difference capitalizing the B. Still doesn't work Same error as before. Capitalize B for me. Quote Link to comment Share on other sites More sharing options...
Revlet Posted May 19, 2009 Author Share Posted May 19, 2009 Oh, I misspelled document.getElementById. You can fix that. And FYI, there was an error. Unlike PHP, you just don't see it on the page. It's like a HTML error. It didn't make a difference capitalizing the B. Still doesn't work Same error as before. Capitalize B for me. YES! everything now works perfectly the way it should. Thank you again VERY VERY much for your help! Sorry for being a pain and asking for the error div in addition... - Revlet Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.