Email Validator
Jul 30, 2003
Email Validator JavaScript (with and without RegExps):
<script language="JavaScript">
//////////////////////////////////////////////////
//<Email Validator>//
// by Premshree Pillai//
//http://www.qiksearch.com//
//http://premshree.resource-locator.com//
//////////////////////////////////////////////////
/* Without RegExps */
function isEmail(who) {
function isEmpty(who) {
var testArr=who.split("");
if(testArr.length==0)
return true;
var toggle=0;
for(var i=0; i<testArr.length; i++) {
if(testArr[i]==" ") {
toggle=1;
break;
}
}
if(toggle)
return true;
return false;
}
function isValid(who) {
var invalidChars=new Array("~","!","@","#","$","%","^","&","*","(",")","+","=","[","]",":",";",",",""","'","|","{","}","","/","<",">","?");
var testArr=who.split("");
for(var i=0; i<testArr.length; i++) {
for(var j=0; j<invalidChars.length; j++) {
if(testArr[i]==invalidChars[j]) {
return false;
}
}
}
return true;
}
function isfl(who) {
var invalidChars=new Array("-","_",".");
var testArr=who.split("");
which=0;
for(var i=0; i<2; i++) {
for(var j=0; j<invalidChars.length; j++) {
if(testArr[which]==invalidChars[j]) {
return false;
}
}
which=testArr.length-1;
}
return true;
}
function isDomain(who) {
var invalidChars=new Array("-","_",".");
var testArr=who.split("");
if(testArr.length<2||testArr.length>4) {
return false;
}
for(var i=0; i<testArr.length; i++) {
for(var j=0; j<invalidChars.length; j++) {
if(testArr[i]==invalidChars[j]) {
return false;
}
}
}
return true;
}
var testArr=who.split("@");
if(testArr.length<=1||testArr.length>2) {
return false;
}
else {
if(isValid(testArr[0])&&isfl(testArr[0])&&isValid(testArr[1])) {
if(!isEmpty(testArr[testArr.length-1])&&!isEmpty(testArr[0])) {
var testArr2=testArr[testArr.length-1].split(".");
if(testArr2.length>=2) {
var toggle=1;
for(var i=0; i<testArr2.length; i++) {
if(isEmpty(testArr2[i])||!isfl(testArr2[i])) {
toggle=0;
break;
}
}
if(toggle&&isDomain(testArr2[testArr2.length-1]))
return true;
return false;
}
return false;
}
}
}
}
/* With RegExp */
function isEmail2(who) {
var email=/^[A-Za-z0-9]+([_.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_.-][A-Za-z0-9]+)*.([A-Za-z]){2,4}$/i;
return(email.test(who));
}
</script>
View 9 Replies
ADVERTISEMENT
Jan 17, 2009
Heres my javascript code that will verify email from email input field and check if the checkbox (I agree condition) was checked:
[Code]....
However, this will work fine when calling with a link "javascript:validate('inputForm');" but if I try to prevent users by submitting form with pressing enter I put it in form onSubmit parameter: <form .. onSubmit="javascript:validate('inputForm');"> which will check the forms and submit data (do return) no matter if it matched or no.
View 11 Replies
View Related
Apr 29, 2006
Last week after much searching, I found the answer to my problem in
this newsgroup. I can't find the thread from which I got my solution,
but I wanted to report back what worked.
When the site visitor fills out the form and submits it, this calls a
rather ordinary asp script like formmail.asp that sends the emails and
displays a "thank you" web page. At the very end of my "thank you" web
page I placed the following:
<script type="text/javascript">
location.href="FileToDownload.exe"
</script>
This causes the file download to get triggered, and asks the user if
they want to save the file. In limited testing this appears to work
fine in both Firefox and IE.
View 13 Replies
View Related
Nov 11, 2011
I'm a mediocre website designer i know html , at JS i'm to noob to actualy make something of my own :) just Edit, i'm still learning and atm i'm working on a web project and I'm struggling to find a way to Filter email addresses to redirect my New Members to their e-mail provider, for example if they would register newmmember@hotmail.com to be forwarded to www.hotmail.com so they would login and activate their account, or if they enter @yahoo.com to be forwarded there . Can you please point out a few things i'm eager to learn how to Forward User to email provider after he creates his account . Or how can i forward email to URL inside my webpage , this could help me with another ideea i have, again this would have to be filtered @yahoo.com , @hotmail.com etc , to be forwarded to a local URL inside the site depending on what Email Provider they enter .
View 5 Replies
View Related
Jul 20, 2005
I have a frameset and one of the frames contains a page that is created on the fly, an
actual word document. I want to have a button in one of the other frames that emails this created page as an email attachment using the email client (outlook or whatever). I created a function as follows:
<script language="JavaScript">
function mailIt()
var page = parent.QandA;
document.write 'mailto: sendmail@example.com?subject=The
document&Attachment='
document.write page;
}
</script>
Which is then called from a button, but it doesnt work! QandA is the
name of the frame that contains the document I want to email as the
attachment.
View 9 Replies
View Related
Mar 29, 2011
Im using the old nopcard scripts on my site. It does every thing right except it does not send a Email to my to my email adres. I dont know how to correct this because i dont know Javascript. I include the script if anybody know how to alter it so that it will send the info to my email adres as well.
The checkout.pl script :
View 3 Replies
View Related
Oct 12, 2010
i hv an input box like this
<td >
<input type="text" name="emailid" id="emailid" onBlur="checkMail(this)" value="emailId" onFocus="this.value=''">
@domain.com</td>
[Code]...
Now problem is as u can see .. i hav to check just "EMAIL ID" not the full "Email address".. i cud not be successful to edit the JS function.
View 1 Replies
View Related
May 7, 2009
i have some script java script which is working but i want to do it some thing else
[Code]....
This script is working for email validation also if email box is empty it says to fill it i want that for all if some one left any box in form it says fill that. i have tried many ways but failed that's why posting here. and the last function is for contactno INPUT field so one can only put number in the field. HTML CODE
[Code]...
View 1 Replies
View Related
Jun 14, 2009
Looking for a good tutorial on how to use jQuery to read email sent tomy site's email address, and how to send email through my site'semail. Basically, how to construct the server email portion of
View 11 Replies
View Related
Apr 6, 2009
Is it possible to create a page (with javascipt) that will send an email to the "me" but the user can't see the destination email address? Im wondering if I can do the "party" with Javascript without using some server page like PHP.
View 1 Replies
View Related
May 15, 2006
I am looking for HTML validator with the following restrictions:
1. Web server is the localhost (page should be validated locally).
2. The page is dynamic (generated by PHP with client side javascript,
which alters the DOM).
I tried the following:
1. Tidy Firefox extenstion (http://users.skynet.be/mgueury/mozilla/).
Unfortunately, it doesn't really makes the real DOM validation. In my
JS code, I had .inerHTML code injection, but this extension didn't show
the injected html code.
2. I am using FireBug Firefox extenstion. This extenstion shows the
real DOM, but unfortunately it doesn't validate the HTML.
3. MS developper toolbar for IE and Web Developper Firefox extenstion
make only external HTML validation.
View 12 Replies
View Related
Aug 7, 2002
Everyone around here sure seems to be doing lots of form validation. Fortunately, I have your solution. I've made a form validator that does LOTS AND LOTS of neat stuff. It's still 'beta' because I'm not done with x-browser 100% etc. Well, you can get all the dope here ....
View 2 Replies
View Related
Oct 6, 2011
Trying to make a simple validator for a form i've just created, but for some reason i cant get it to redirect to the pages upon the IF statements being fulfilled.I've got a feeling its because the form seems to still submit the selection...
[Code]...
View 1 Replies
View Related
Jan 26, 2005
I have some problems in validating my XHTML Transitional page with W3C validator. The problems are with this JS code:
Code:
<script language="javascript1.1" src="http://...."></script>
<noscript>
<a href="http://...." title=""><img src="http://...." width="468" height="60" alt="" /></a>
</noscript>
Is there a way to validate this code???
View 10 Replies
View Related
Mar 29, 2006
Using function FrontPage_Form1_Validator(theForm)
and added a function to trap a radio optin like
if (theForm.opt_in.value != "yes" || theForm.opt_in.value != "no")
{
alert("Please make a choice for the "opt_in" field.");
theForm.opt_in.focus();
return (false);
}
This traps if neither radio has been clicked BUT when I click on OK in the error message box it continues on without having click on a radio button?
Is the action of clicking the OK in the error message setting to True or something? Any idea of a fix?
View 1 Replies
View Related
Jun 14, 2007
Is there any function in JavaScript which validates the date format like isNaN() for numbers? Or have anyone made such function which validates the date entered in the text box i.e. dd-mm-yyyy or yyyy-mm-dd or mm-dd-yyyy or dd/mm/yyy or mm/dd/yyyy or yyyy/mm/dd are only the valid dates??
View 1 Replies
View Related
Jul 20, 2005
I'm trying to write a generic/reusable form validator in Javascript...
just something that checks to make sure required fields have a value. By
generic I mean I don't want to explicitly reference the name/id of the
form or the name of any of the data fields within a "validation"
function.
My first shot seems to have some errors in it:
FieldsToValidateByForm = {};
FieldsToValidateByForm['contact'] = ["FirstName",
"LastName","State","Email"];
function validate(form)
{
problemFields = new Array();
returnval = true;
FieldsToValidate = FieldsToValidateByForm[form.id];
for(i=0; i < FieldsToValidate.length; i++) {
fieldInQuestion = form[FieldsToValidate[i]];
if(fieldInQuestion.value.length < 1) //problem spot?
problemFields.push(FieldsToValidate[i]);
}
if(problemFields.length > 0) {
returnval = false;
warn(problemFields); /* tells user they're missing a field,
that's all */
}
return returnval;
}
What I think is happening (not sure) is that the expression
form[fieldsToValidate[i]] is not giving me what I want: a reference to
the object corresponding to the form field with the same name. In
otherwords, I must have some fundamental misunderstanding of how the DOM
works here. Unfortunately, I can't seem to find a good enough reference
to set me straight....
View 5 Replies
View Related
Jun 5, 2009
I'm quite new to Jquery, so I need some sort of advice. I'm working on a webbased application with a webservice. First it was a simple html site, but later I started using Jquery. Data is inserted in some forms, this I can easily validate through the validator. Now after all the data is ok, it's send to the webservice through the C#-code. Some calculations are being made with the data and a dataset is returned. Now some errors can occur while doing the calculations. I can't get some manual error in the errorbox of the validator. Is it possible to let the validator run some c#-function so I can see if the data is correct? Or can I set a unvisible checkbox to true/false through the c#-code so the validator check this box? A problem with both is, that the validator runs when I click on the "Next"-button. After the validaton, the function starts, so if I set the checkbox to false, the validator won't even notice. Anyone knows a handy approach for this?
[Code]...
View 3 Replies
View Related
Aug 8, 2011
Here is the line of code:
Which produces: {0}.00 instead of $0.00
Why is that happening? how can i fix it?
I'm including the jquery.validate.min.js file, fyi...
jQuery Validation Plugin 1.8.1
View 1 Replies
View Related
Jul 27, 2011
I've seen tons of things for fixing it with IE6 but some of my users are getting this with IE8.I don't see too many answers to problems with this plugin is it not being supported anymore?I also see that the version on the jQuery site is 1.5.5 and the version on the author's site is 1.8.1; does this mean that the author isn't keeping things here updated and thus isn't supporting the product via these channels like he says on his site?
View 3 Replies
View Related
Jul 2, 2009
I wanted to know if we have some validator tool available which can validate our jsp code for W3C standards and for cross browser compatibility for browsers like IE, Mozilla, Chrome.
View 1 Replies
View Related
Jul 21, 2010
I am trying to track down why this custom validator is failing with an error that args is undefined. There are two funnctions - one works and one does not.the bold italicized item is where the error is being generated.Function validHygieneNote works as expected however.
View 1 Replies
View Related
Dec 1, 2005
<script type="text/javascript"><!--
function Validate_form(form) {
var fields = [];
this.add = function(element, err) {
if ( !('__validate' in form[element]) ) {
form[element].__validate = function() {
if (this.value=='') {
alert(err);
this.focus();
return false;
}
}
}
fields.push(form[element]);
}
this.check = function() {
var len = fields.length;
for (var i=0; i<len; i++)
if ( !fields[i].__validate() )
return false;
return true;
}
}
function form_onsubmit(form) {
var vform = new Validate_form(form);
vform.add('domain_name', 'The domain field is empty');
return(vform.check());
}
--></script>
<form name="signup" method="post" action="" onsubmit="return form_onsubmit();">
<input type="text" name="domain_name" />
<input type="submit" />
</form>
This is nothing special. just a basic empty field validator. it's probably not as efficient as it could be because it assigns the function to the various elements. It also only supports text fields. I was thinking of allowing a 3rd argument on Validate_form.add to accept something like Validate_form.stock.email/number/etc (functions). ah well..
View 3 Replies
View Related
Jan 9, 2011
My client is using the following script to validate a form : -
[URL]
I want to be able to validate a Postcode by matching a regular expression (using this script). There is no default option with this jQuery script to do so. My question is can I add such a custom regex to this script?
I have only ever written validation in "normal" JS before. Also I would like the JS regex to match the existing one serverside (PHP):
[code]....
View 11 Replies
View Related
Aug 15, 2005
I'm attempting to write a piece of code that acts as a client side
validator for all drop down lists on a webform, giving an error if the
SelectedIndex = 0.
Here is what i have:
function clientValidateDDL(source, args)
{
var dropdown = document.getElementById(source*.controltovalidate) ;
if (dropdown.selectedindex == 0)
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
However, it does not give an error for any selected index, including
index 0, so i'm presuming the var dropdown = ... line is not correctly
selecting the dropdownlist that launched the function.
ClientValidationFunction="clie*ntValidateDDL" is inserted in the
custom validator tags. and ControlToValidate is also present and correct.
View 6 Replies
View Related
May 21, 2011
how to specify the event in the rule?For example I create a rulejQuery.validator.addMethod("greaterThanZero", function(value, element) { return his.optional(element) || (parseFloat(value) > 0); }, "* Amount must be greater than zero");Iattach this rule to the form$('form').validate({ rules : { amount : { greaterThanZero : true } } });how can I specify when this rule should be checked , for example onChange oronKeypress or when another field is edited. Is it possible to do this as a form validate rule?
View 1 Replies
View Related