Welcome to Dream.In.Code
Getting Help is Easy!

Join 131,519 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,911 people online right now. Registration is fast and FREE... Join Now!




Email address validation

 
Reply to this topicStart new topic

Email address validation

MasterRoger
post 7 Oct, 2008 - 05:12 AM
Post #1


New D.I.C Head

*
Joined: 16 Sep, 2008
Posts: 6

Does anyone would have an idea how to validate e-mail with fix domain?

The domain would be something like @abcd-dcba.gc.ca




ex: joblow@abc-cba.gc.ca


Thanks all, I'm really a newby at this!
User is offlineProfile CardPM

Go to the top of the page


PsychoCoder
post 7 Oct, 2008 - 05:28 AM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,904



Thanked 115 times

Dream Kudos: 8450

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


I have a feeling you put this in the wrong forum, since this is the Graphics Design forum and you're asking a programming question. What language are you programming in so this can get moved to the proper forum?
User is online!Profile CardPM

Go to the top of the page

MasterRoger
post 7 Oct, 2008 - 05:28 AM
Post #3


New D.I.C Head

*
Joined: 16 Sep, 2008
Posts: 6

Does anyone would have an idea how to validate in javascript, e-mail with fix domain?

The domain would be something like @abcd-dcba.gc.ca




ex: joblow@abc-cba.gc.ca


Thanks all, I'm really a newby at this!
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 7 Oct, 2008 - 05:30 AM
Post #4


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,904



Thanked 115 times

Dream Kudos: 8450

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Please don't create duplicate topics, topics merged
User is online!Profile CardPM

Go to the top of the page

AmitTheInfinity
post 7 Oct, 2008 - 05:40 AM
Post #5


C Surfing ∞

Group Icon
Joined: 25 Jan, 2007
Posts: 1,011



Thanked 34 times

Dream Kudos: 125
My Contributions


I am not good at javascript at all. So what I did was, go over net, try to find email validating forms, view source files and copy their email validating function smile.gif. You can do the same.
I used gmail.com as your fix domain, and haven't changed much in that ready function. You can do the changes you require.

javascript

function echeck(str) {

var at="@gmail.com"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}

return true
}



I hope this will help you. smile.gif
User is online!Profile CardPM

Go to the top of the page

MasterRoger
post 7 Oct, 2008 - 05:58 AM
Post #6


New D.I.C Head

*
Joined: 16 Sep, 2008
Posts: 6

QUOTE(PsychoCoder @ 7 Oct, 2008 - 06:30 AM) *

Please don't create duplicate topics, topics merged



Sorry, I didn't know how to move the post to another forum
User is offlineProfile CardPM

Go to the top of the page

MasterRoger
post 7 Oct, 2008 - 06:24 AM
Post #7


New D.I.C Head

*
Joined: 16 Sep, 2008
Posts: 6

QUOTE(AmitTheInfinity @ 7 Oct, 2008 - 06:40 AM) *

I am not good at javascript at all. So what I did was, go over net, try to find email validating forms, view source files and copy their email validating function smile.gif. You can do the same.
I used gmail.com as your fix domain, and haven't changed much in that ready function. You can do the changes you require.

javascript

function echeck(str) {

var at="@gmail.com"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}

return true
}



I hope this will help you. smile.gif




THANKS IT'S WORKING LIKE A CHARM!
User is offlineProfile CardPM

Go to the top of the page

MasterRoger
post 15 Oct, 2008 - 05:37 AM
Post #8


New D.I.C Head

*
Joined: 16 Sep, 2008
Posts: 6

QUOTE(AmitTheInfinity @ 7 Oct, 2008 - 06:40 AM) *

I am not good at javascript at all. So what I did was, go over net, try to find email validating forms, view source files and copy their email validating function smile.gif. You can do the same.
I used gmail.com as your fix domain, and haven't changed much in that ready function. You can do the changes you require.

javascript

function echeck(str) {

var at="@gmail.com"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}

return true
}



I hope this will help you. smile.gif



QUOTE

THIS IS WORKING FINE THANKS FOR YOUR HELP
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 01:01AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month