Validate email addresses

Results 1 to 2 of 2

Thread: Validate email addresses

  1. #1
    Join Date
    Dec 1969

    Default Validate email addresses

    I need to validate for correct email address. The client can leave it blank but any input must be of the correct value.<BR>Here is what I have written but it falls over.<BR><BR>if (!(document.couples.txtFemEmail.value &#060;1))<BR> {<BR> if (instr(document.couples.txtFemEmail,"@")= 0) ;or instr (document.couples.txtFemEmail,".") = 0)<BR> {<BR> alert("You did not enter in your correct Email address.");<BR> document.couples.txtFemHomePhone.focus();<BR> return false;<BR> }<BR>} <BR>This runs but gives a run time error,is it because the function "instr" is a function I got from vb script.<BR>Is there a j script function I can place in its place.<BR>If Bill Wilkinson reads this I really appreciate the great advive I have received form you so far cheers colin

  2. #2
    Join Date
    Dec 1969

    Default Look in JS docs...<BR><BR>Read about all the methods (and they are *METHODS* not functions!) on the Sting object in JS.<BR><BR>Hint: Look at "indexOf".<BR><BR>But this is pretty cruddy email validation. A user could enter<BR> .@<BR>and it would pass. Or they could enter<BR> .@@@@@@@@@@@@@@@@@@.@@@@@@@@@@@@@@@@@@.<BR>and all is okay. Or or or.<BR><BR>Go find a *good* email validator on one of the JS sites, such as or (and their JS FAQ).<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts