Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: compare two email address to confirm they typed it in correctly


Message #1 by "Jeff McFarland" <jeff@s...> on Fri, 4 Jan 2002 15:46:14
glad to hear it!

-----Original Message-----
From: Jeff McFarland [mailto:jeff@s...]
Sent: 07 January 2002 15:08
To: JavaScript HowTo
Subject: [javascript_howto] RE: compare two email address to confirm t-
- - - - hey - typed it in correctly


It WORKS!!

Thanks a lot!

J

> where I've put return(); in the code, replace it with return(false);, and
> then replace myForm.submit(); with return(true);
> 
> -----Original Message-----
> From: Jeff McFarland [mailto:jeff@s...]
> Sent: 07 January 2002 14:49
> To: JavaScript HowTo
> Subject: [javascript_howto] RE: compare two email address to confirm t-
> - - - hey - typed it in correctly
> 
> 
> Great!  Where would I place the "return false" statement in the code and 
> what would the statement look like?
> 
> Thx
> 
> > In that case instead of making the routine run as the onclick handler 
for
> > the button, make it the onsubmit handler for the form, then make sure 
you
> > return false if you don't want the form to be submitted.
> > 
> > -----Original Message-----
> > From: Jeff McFarland [mailto:jeff@s...]
> > Sent: 04 January 2002 18:08
> > To: JavaScript HowTo
> > Subject: [javascript_howto] RE: compare two email address to confirm t-
> > - - hey - typed it in correctly
> > 
> > 
> > is that my problem..?  I am using an image for my submit button.  So 
the 
> > type is set to image.  So do I have to change that to button?  Is 
there 
> > anyway to have an image for your submit button and have this code work?
> > 
> > Thanks again,
> > 
> > J
> > 
> > > change the input type to button, otherwise it will submit the form
> > > regardless
> > > 
> > > providing that you only have one form on your page then the form 
> > reference
> > > will work, otherwise replace the 0 with the index of the form (first 
> > form on
> > > the page is 0, second is 1 etc).  You can refer to the form by name 
> too,
> > > document.forms("myform")
> > > 
> > > -----Original Message-----
> > > From: Jeff McFarland [mailto:jeff@s...]
> > > Sent: 04 January 2002 16:28
> > > To: JavaScript HowTo
> > > Subject: [javascript_howto] RE: compare two email address to confirm 
t-
> > > - hey - typed it in correctly
> > > 
> > > 
> > > Thanks for all your help! But, I have used your code and put the 
> values 
> > of 
> > > my textfield "Email" and "Email2" into your js code.  I also 
inserted 
> > the 
> > > onclick command in the submit button. .. and no luck... still not 
> > > working.  I have not changed the "myform" value in your code, cause 
I 
> > > don't know what else I could put in there.  Almost there... ;-)
> > > 
> > > Later,
> > > 
> > > J
> > > 
> > > > use whatever names you've given your fields instead of email1 and 
> > email2
> > > > 
> > > > -----Original Message-----
> > > > From: Jeff McFarland [mailto:jeff@s...]
> > > > Sent: 04 January 2002 16:18
> > > > To: JavaScript HowTo
> > > > Subject: [javascript_howto] RE: compare two email address to 
confirm 
> t-
> > > > hey - typed it in correctly
> > > > 
> > > > 
> > > > Wow.. thx!
> > > > 
> > > > so the only variables that I need to change 
> > > are "myForm","email1","email2" 
> > > > inorder for this to work?
> > > > 
> > > > > ok, ok...
> > > > > 
> > > > > instead of a submit button on your form, just have a normal 
button 
> > > with 
> > > > an
> > > > > event handler
> > > > > 
> > > > > <INPUT TYPE="BUTTON" VALUE="Submit" ONCLICK="submitForm()">
> > > > > 
> > > > > then use an event handler like this:
> > > > > 
> > > > > function submitForm(){
> > > > > 	
> > > > > 	var myForm = document.forms(0);
> > > > > 
> > > > > 	if(myForm.email1.value!=myForm.email2.value){
> > > > > 		alert("Emails not the same");
> > > > > 		return();
> > > > >  	}
> > > > > 
> > > > > 	if(myForm.name.value==""){
> > > > > 		alert("Please enter a name");
> > > > > 		return();
> > > > > 	}
> > > > > 
> > > > > 	//check other criteria in the same way
> > > > > 
> > > > > 	myForm.submit();
> > > > > }
> > > > > 
> > > > > 
> > > > > 
> > > > > -----Original Message-----
> > > > > From: Jeff McFarland [mailto:jeff@s...]
> > > > > Sent: 04 January 2002 16:01
> > > > > To: JavaScript HowTo
> > > > > Subject: [javascript_howto] RE: compare two email address to 
> confirm
> > > > > they - typed it in correctly
> > > > > 
> > > > > 
> > > > > Yes,
> > > > > 
> > > > > That is exactly what I need to do.  I'm new to JS so.. I am 
sorry 
> I 
> > > > don't 
> > > > > completely know what to do with the code below.  Could you 
> eliborate 
> > a 
> > > > > little more?
> > > > > 
> > > > > Thx,
> > > > > 
> > > > > J
> > > > > 
> > > > > > do you just mean comparing the values of two textboxes?
> > > > > > 
> > > > > > something like this
> > > > > > 
> > > > > > if(email1.value!=email2.value){
> > > > > > 	alert("Emails not the same");
> > > > > > } else {
> > > > > > 	document.forms(0).submit();
> > > > > > }
> > > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Jeff McFarland [mailto:jeff@s...]
> > > > > > Sent: 04 January 2002 15:46
> > > > > > To: JavaScript HowTo
> > > > > > Subject: [javascript_howto] compare two email address to 
confirm 
> > they
> > > > > > typed it in correctly
> > > > > > 
> > > > > > 
> > > > > > Have any of you seen a script that will compare two email 
> address 
> > to 
> > > > > > confirm they are the same before the user can submit the form?
> > > > > > 
> > > > > > Thx,
> > > > > > 
> > > > > > J
> > > > > > $subst('Email.Unsub').
> > > > > > 
> > > > > > 
> > > > 
> > 
________________________________________________________________________
> > > > > > Scottish Enterprise Network
> > > > > > http://www.scottish-enterprise.com
> > > > > > 
> > > > > > Headquarters Address & Contact Numbers
> > > > > > 
> > > > > > 150 Broomielaw
> > > > > > 5 Atlantic Quay
> > > > > > Glasgow
> > > > > > G2 8LU.
> > > > > > Tel:  +44 (0) 141 248 2700.
> > > > > > Fax:  +44 (0)141 221 3217
> > > > > > 
> > > > > >  This message is sent in confidence for the addressee only.
> > > > > > It may contain legally privileged information. The contents 
are 
> > not 
> > > to
> > > > > > be disclosed to anyone other than the addressee. Unauthorised 
> > > > recipients
> > > > > > are requested to preserve this confidentiality and to advise 
the 
> > > sender
> > > > > > immediately of any error in transmission.
> > > > > > 
> > > > > > 
> > > > > 
> > > > > $subst('Email.Unsub').
> > > > > 
> > > > > 
> > > 
> ________________________________________________________________________
> > > > > Scottish Enterprise Network
> > > > > http://www.scottish-enterprise.com
> > > > > 
> > > > > Headquarters Address & Contact Numbers
> > > > > 
> > > > > 150 Broomielaw
> > > > > 5 Atlantic Quay
> > > > > Glasgow
> > > > > G2 8LU.
> > > > > Tel:  +44 (0) 141 248 2700.
> > > > > Fax:  +44 (0)141 221 3217
> > > > > 
> > > > >  This message is sent in confidence for the addressee only.
> > > > > It may contain legally privileged information. The contents are 
> not 
> > to
> > > > > be disclosed to anyone other than the addressee. Unauthorised 
> > > recipients
> > > > > are requested to preserve this confidentiality and to advise the 
> > sender
> > > > > immediately of any error in transmission.
> > > > > 
> > > > > 
> > > > 
> > > > $subst('Email.Unsub').
> > > > 
> > > > 
> > 
________________________________________________________________________
> > > > Scottish Enterprise Network
> > > > http://www.scottish-enterprise.com
> > > > 
> > > > Headquarters Address & Contact Numbers
> > > > 
> > > > 150 Broomielaw
> > > > 5 Atlantic Quay
> > > > Glasgow
> > > > G2 8LU.
> > > > Tel:  +44 (0) 141 248 2700.
> > > > Fax:  +44 (0)141 221 3217
> > > > 
> > > >  This message is sent in confidence for the addressee only.
> > > > It may contain legally privileged information. The contents are 
not 
> to
> > > > be disclosed to anyone other than the addressee. Unauthorised 
> > recipients
> > > > are requested to preserve this confidentiality and to advise the 
> sender
> > > > immediately of any error in transmission.
> > > > 
> > > > 
> > > 
> > > $subst('Email.Unsub').
> > > 
> > > 
> ________________________________________________________________________
> > > Scottish Enterprise Network
> > > http://www.scottish-enterprise.com
> > > 
> > > Headquarters Address & Contact Numbers
> > > 
> > > 150 Broomielaw
> > > 5 Atlantic Quay
> > > Glasgow
> > > G2 8LU.
> > > Tel:  +44 (0) 141 248 2700.
> > > Fax:  +44 (0)141 221 3217
> > > 
> > >  This message is sent in confidence for the addressee only.
> > > It may contain legally privileged information. The contents are not 
to
> > > be disclosed to anyone other than the addressee. Unauthorised 
> recipients
> > > are requested to preserve this confidentiality and to advise the 
sender
> > > immediately of any error in transmission.
> > > 
> > > 
> > 
> > $subst('Email.Unsub').
> > 
> > 
________________________________________________________________________
> > Scottish Enterprise Network
> > http://www.scottish-enterprise.com
> > 
> > Headquarters Address & Contact Numbers
> > 
> > 150 Broomielaw
> > 5 Atlantic Quay
> > Glasgow
> > G2 8LU.
> > Tel:  +44 (0) 141 248 2700.
> > Fax:  +44 (0)141 221 3217
> > 
> >  This message is sent in confidence for the addressee only.
> > It may contain legally privileged information. The contents are not to
> > be disclosed to anyone other than the addressee. Unauthorised 
recipients
> > are requested to preserve this confidentiality and to advise the sender
> > immediately of any error in transmission.
> > 
> > 
> 
> $subst('Email.Unsub').
> 
> ________________________________________________________________________
> Scottish Enterprise Network
> http://www.scottish-enterprise.com
> 
> Headquarters Address & Contact Numbers
> 
> 150 Broomielaw
> 5 Atlantic Quay
> Glasgow
> G2 8LU.
> Tel:  +44 (0) 141 248 2700.
> Fax:  +44 (0)141 221 3217
> 
>  This message is sent in confidence for the addressee only.
> It may contain legally privileged information. The contents are not to
> be disclosed to anyone other than the addressee. Unauthorised recipients
> are requested to preserve this confidentiality and to advise the sender
> immediately of any error in transmission.
> 
> 

$subst('Email.Unsub').

________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com

Headquarters Address & Contact Numbers

150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel:  +44 (0) 141 248 2700.
Fax:  +44 (0)141 221 3217

 This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.



  Return to Index