Click here to Skip to main content
11,789,710 members (62,419 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
hi all,

Am using validation control in my project , my problem is email address that is when i enter the valid email address eg: then the code will be executed, as it is i have follow the above mail address but slide changes for domain where the mail id is abc@gmail.lkj which is also executed but its not a valid domain name anyhow it will also executed i dont know why? so my problem is if i enter the unknown domain name like .vbk,.nhgfd,.oikhgh etc.... the form will not be execute thats i need. i will need only registered mail id (eg: com,.org,.net etc...) will be executed.please let me know if anybody know this, i tried so many times but i can't, please find the below code ,


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript form validation - email validation</title>
<style type="text/css">
li {list-style-type: none;
font-size: 16pt;
.mail {
margin: auto;
padding-top: 10px;
padding-bottom: 10px;
width: 400px;
background : #D8F1F8;
border: 1px soild silver;
.mail h2 {
margin-left: 38px;
input {
font-size: 20pt;
input:focus, textarea:focus{
background-color: lightyellow;
.submit {
font-size: 12pt;
margin-left: 100px;
.rq {
color: #FF0000;
font-size: 10pt;
<script type='text/javascript'>
function ValidateEmail(inputText)
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
return true;
alert("You have entered an invalid email address!");
return false;
<body onload='document.form1.text1.focus()'>
<div class="mail">
<h2>Input an email and Submit</h2>
<form name="form1" action="#">
<li><input type='text' name='text1'/></li>
<li> </li>
<li class="submit"><input type="submit" name="submit" value="Submit" onclick="ValidateEmail(document.form1.text1)"/></li>
<li> </li>
Posted 24-Sep-12 6:04am
Marcus Kramer at 24-Sep-12 13:32pm
If you want a "Valid Domain" filter, then you would have to write one. There is no default method or such out there that does this.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

With the recent changes imposed by ICANN, there is no such thing as an "invalid" top-level domain name any more. Anyone will be able to register just about any top-level domain they want now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 999
1 Maciej Los 765
2 KrunalRohit 686
3 CPallini 606
4 Richard MacCutchan 430

Advertise | Privacy | Mobile
Web04 | 2.8.1509028.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100