verN Posted March 17, 2007 Share Posted March 17, 2007 This is an edit form where users can update the email addresses. I had the following working when a user removed an email address and then clicked on submit and if an email address wasn't added a message would appear. However, i have now made the email address an array and the following code does not work. Thanks in advance p.s email[] is an array <script language="Javascript" type="text/javascript"> function checkEmail() { for (i = 0; i < email.length; i++) { if(document.form2.email[i].value=='') { alert('Please input a valid email address!'); return false; } else { return true; } } } </script> Basically this is part of the update form where the user can make any chnages to an email address, they cannot completely remove an email address that's where this message appears Quote Link to comment Share on other sites More sharing options...
ldsmike88 Posted March 17, 2007 Share Posted March 17, 2007 Well first off, why does it have to be an array? Secondly, you need to pass the array to the function. The best way to do that would probably be to pass it as a string and then split it into an array. Quote Link to comment Share on other sites More sharing options...
emehrkay Posted March 17, 2007 Share Posted March 17, 2007 i dont quite understand what you're doing, but this document.form2.email says - get email[number i] from form2. how many email fields do you have? 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.