/    Sign up×
Community /Pin to ProfileBookmark

email validation

Hi I am trying to create a form that has a user enter their email address in a text box and clicks the “Submit” button, once it submits it adds the users email address and checks to make sure its a valid email. If the user enters any other character other than “@” or “.” (for an example “/”) then a message should display with the focus on the area where the mistake was made. After the email validates, I wanted it to be added as an element in an array for the user can click on the “find” button for an example by typing in one letter such as “c” it would bring up any emails stored that begin with the letter “c”. This is what I did so far and it only checks to make sure the email is in the correct format.
html><head><meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<title>Check Email Address</title>
<script language=”javascript”>

function checkEmail(inputvalue){
var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+.([a-zA-Z])+([a-zA-Z])+/;
if(pattern.test(inputvalue)){

alert(“true”);

}else{

alert(“false”);
}
}
</script>
</head><body>
<form name=”signupform”>
Input your email: <input name=”email” type=”text” class=”inputs” id=”email_address”
value=”[email protected]” size=”35″ maxlength=”255″>
<input name=”summit” type=”submit” value=”Check” onClick=”checkEmail(document.signupform.email.value)”>

</form></body></html>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @misty28 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...