Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Validate email?

  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Validate email?

    Hi All,

    I'm sure this will be a quick one for most of you.

    I have the following code in an asp script to check a form, but how can i check that the email field has the required elements i.e. a@b.com

    Code:
    		Response.Write( "<script language=""JavaScript"" type=""text/javascript"">" & vbCrLf)
    		Response.Write( "<!--" & vbCrLf)
    		Response.Write( "function checkform ( form )" & vbCrLf)
    		Response.Write( "{" & vbCrLf)
    		Response.Write( "  if (form.ratingtitle.value == """") {" & vbCrLf)
    		Response.Write( "    alert( ""Please enter a title."" );" & vbCrLf)
    		Response.Write( "    form.ratingtitle.focus();" & vbCrLf)
    		Response.Write( "    return false ;" & vbCrLf)
    		Response.Write( "  }" & vbCrLf)
    		
    		Response.Write( "  if (form.ratingcomment.value == """") {" & vbCrLf)
    		Response.Write( "    alert( ""Please enter your comment."" );" & vbCrLf)
    		Response.Write( "    form.ratingcomment.focus();" & vbCrLf)
    		Response.Write( "    return false ;" & vbCrLf)
    		Response.Write( "  }" & vbCrLf)
    		
    		Response.Write( "  if (form.ratinglocation.value == """") {" & vbCrLf)
    		Response.Write( "    alert( ""Please enter your location."" );" & vbCrLf)
    		Response.Write( "    form.ratinglocation.focus();" & vbCrLf)
    		Response.Write( "    return false ;" & vbCrLf)
    		Response.Write( "  }" & vbCrLf)
    		
    		Response.Write( "  if (form.ratingname.value == """") {" & vbCrLf)
    		Response.Write( "    alert( ""Please enter your name."" );" & vbCrLf)
    		Response.Write( "    form.ratingname.focus();" & vbCrLf)
    		Response.Write( "    return false ;" & vbCrLf)
    		Response.Write( "  }" & vbCrLf)
    		
    		Response.Write( "  if (form.ratingemail.value == """") {" & vbCrLf)
    		Response.Write( "    alert( ""Please enter your email address."" );" & vbCrLf)
    		Response.Write( "    form.ratingemail.focus();" & vbCrLf)
    		Response.Write( "    return false ;" & vbCrLf)
    		Response.Write( "  }" & vbCrLf)
    		
    		
    		Response.Write( "  return true ;" & vbCrLf)
    		Response.Write( "}" & vbCrLf)
    		Response.Write( "//-->" & vbCrLf)
    		Response.Write( "</script>" & vbCrLf)

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New Coder
    Join Date
    Feb 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    mmmm..... LOST!


  •  

    Posting Permissions

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