Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Not validating emails.



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> HTML Forum
View previous topic :: View next topic  
Author Message
mcbc



Joined: 21 May 2008
Posts: 12

PostPosted: Wed May 21, 2008 4:36 pm    Post subject: Not validating emails. Reply with quote

Hi my script will not run the code to check email, here is the code, and any help will be great.


<style type="text/css">
<!--
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif}
.floatingImage {
position: absolute;
left: 597px;
top: 109px;
width: 415px;
height: 76px;
}
a:link {
color: #009900;
}
-->
</style>
<style type="text/css">
<!--
.style11{
font-size:80%;
position:super;
vertical-align:super;
}
-->
</style>
<style type="text/css">
<!--
.style12{
font-size:75%;
position:super;
vertical-align:top;
}
-->
</style>

<SCRIPT language="JavaScript">
function calculateOrder()
{
var quantity, totalOrder;

quantity = parseFloat(document.frmOrder.BookNumber.value);
totalOrder = quantity * 12.95;

document.frmOrder.Price.value = totalOrder.toFixed(2);
}
</SCRIPT>

<script type="text/javascript">

function CompareEmail(Email, ConfirmEmail)
var Email == document.frmOrder.Email.value;
var ConfirmEmail == document.frmOrder.Confirm Email.value;
{
if (Email == Confirm Email){
return true;
} else if (Email == '' || Confirm Email == '')
{
alert('Please fill out both email fields.');
return false;
}else{
(Email != Confirm Email)
alert('Email values are not equal to one another!');
return false;}
}
</script>

<link href="forms.css" rel="stylesheet" type="text/css" />
</head>
<body class="oneColFixCtrHdr">



<div id="container">
<div id="header">
<!-- end #header --></div>
<div id="mainNav">
<ul>

</ul>
</div>
<div id="mainContent">
<div id="rightcolumn">

</div>
<div class="style1" id="leftcolumn" style="position:absolute; width:420px; top:185px;padding-right:5px;">
<h1 class="titles">Manual $12.95 + shipping and handling</h1>

Printed using 100% recycled paper: 68 pages, 8.5&quot; x 11&quot;, coil binding, black and white interior ink.<br />
Maufactured using the ECOLITH<span class="style11">®</span> Process.<br />

<br />
<span class="titles"><strong>Description</strong></span><br />
<br />
Learn the basics of how the real estate profession will participate in the new arena of &quot;green.&quot; Topics are discussed as an introduction as the first level in the highly acclaimed &quot;Real Estate Environmental and Energy Education Certification Series.&quot; This series will be written and produced over the next 4 years, with collaboration by &quot;green building&quot; experts knowledgeable in all phases of the &quot;green&quot; built structure.
<p>&nbsp;</p>
<FORM METHOD="POST" ACTION="mailto:?&subject=Green Manual Order!!Smile " ENCTYPE="text/plain" method="post" name="frmOrder" onsubmit="return CompareEmail(Email, ConfirmEmail);">

<legend></legend>

<label for="required1"><span>*</span>Email</label>
<input type="text" name="Email" id="Email*" /><br />

<label for="required2"><span>*Confirm Email</span></label>
<input type="text" name="Confirm Email" id="ConfirmEmail*" /><br />

<label for="BookOrder">Number of Books</label>
<input type="text" name="BookNumber" size="5" maxlength="5" id="Number of Books" onchange="calculate()" value="0" />
<input type="button" value="Calculate" name="btnCalculate" onClick="calculateOrder()"><br />
<label for="Price">Price$</label>
<input type="text" name="Price" size="10" maxlength="15" id="Price of Books" /> (+ Shipping and Handling and Taxes)<br />
<br/>


<input type="submit" value="Submit" onclick="return CompareEmail(Email, ConfirmEmail);"><br />


<label for="Confirm">We will call you to confirm your order, shipping,
and payment details.</label><br /><br />


</fieldset>
</form>


</div>
</div>


</body>
</html>
Back to top
View user's profile Send private message
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 563
Location: Cebu City Philippines

PostPosted: Thu May 22, 2008 2:34 am    Post subject: Re: Not validating emails. Reply with quote

When assigning a variable, it should only be = and not ==
Quote:

Code:

var Email == document.frmOrder.Email.value;
var ConfirmEmail == document.frmOrder.Confirm Email.value;



Also, JS is case senstive Confirm Email is different from ConfirmEmail.
Your problem is that you don't have a ConfirmEmail texbox, but a Confirm Email. Don't use both ConfirmEmail as name and id (though you suffix the latter with *) because IE regards the two as synonymous.

This part in your JS is correct, but you should also note that when the user has no input on both Email and Confirm Email it still validates:
Code:

if (Email == ConfirmEmail)


language is a deprecated attribute used in <script> tag. The modern way is to use type attriibute.

Validation should be on submit (only) and not with the onclick of the submit button.

I've got a lot of ammendments from your markups and the script. See if this helps:
Code:

<html>
<head>
<style type="text/css">
<!--
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif}
.floatingImage {
position: absolute;
left: 597px;
top: 109px;
width: 415px;
height: 76px;
}
a:link {
color: #009900;
}
-->
</style>
<style type="text/css">
<!--
.style11{
font-size:80%;
position:super;
vertical-align:super;
}
-->
</style>
<style type="text/css">
<!--
.style12{
font-size:75%;
position:super;
vertical-align:top;
}
-->
</style>

<script type="text/javascript">
function calculateOrder()
{
var quantity, totalOrder;

quantity = parseFloat(document.frmOrder.BookNumber.value);
totalOrder = quantity * 12.95;
document.frmOrder.Price.value = totalOrder.toFixed(2);
}
function CompareEmail()
{
var Email = document.frmOrder.Email.value;
var ConfirmEmail = document.frmOrder.ConfirmEmail.value;
if ((Email == ConfirmEmail)&&(Email!='')&&(ConfirmEmail!=''))
{
return true;
}
else if (Email == '' || ConfirmEmail == '')
{
alert('Please fill out both email fields.');
return false;
}
else if(Email != ConfirmEmail)
{
alert('Email values are not equal to one another!');
return false;}
}
</script>

<link href="forms.css" rel="stylesheet" type="text/css" />
</head>
<body class="oneColFixCtrHdr">



<div id="container">
<div id="header">
<!-- end #header --></div>
<div id="mainNav">
<ul>

</ul>
</div>
<div id="mainContent">
<div id="rightcolumn">

</div>
<div class="style1" id="leftcolumn" style="position:absolute; width:420px; top:185px;padding-right:5px;">
<h1 class="titles">Manual $12.95 + shipping and handling</h1>

Printed using 100% recycled paper: 68 pages, 8.5&quot; x 11&quot;, coil binding, black and white interior ink.<br />
Maufactured using the ECOLITH<span class="style11">®</span> Process.<br />

<br />
<span class="titles"><strong>Description</strong></span><br />
<br />
Learn the basics of how the real estate profession will participate in the new arena of &quot;green.&quot; Topics are discussed as an introduction as the first level in the highly acclaimed &quot;Real Estate Environmental and Energy Education Certification Series.&quot; This series will be written and produced over the next 4 years, with collaboration by &quot;green building&quot; experts knowledgeable in all phases of the &quot;green&quot; built structure.
<p>&nbsp;</p>
<FORM METHOD="POST" ACTION="mailto:?&subject=Green Manual Order!! " ENCTYPE="text/plain" method="post" name="frmOrder" onsubmit="return CompareEmail();">

<legend></legend>

<label for="required1"><span>*</span>Email</label>
<input type="text" name="Email" id="Email*" /><br />

<label for="required2"><span>*Confirm Email</span></label>
<input type="text" name="ConfirmEmail"/><br />

<label for="BookOrder">Number of Books</label>
<input type="text" name="BookNumber" size="5" maxlength="5" id="Number of Books" onchange="calculate()" value="0" />
<input type="button" value="Calculate" name="btnCalculate" onClick="calculateOrder()"><br />
<label for="Price">Price$</label>
<input type="text" name="Price" size="10" maxlength="15" id="Price of Books" /> (+ Shipping and Handling and Taxes)<br />
<br/>


<input type="submit" value="Submit"><br />


<label for="Confirm">We will call you to confirm your order, shipping,
and payment details.</label><br /><br />


</fieldset>
</form>


</div>
</div>


</body>
</html>


If you have further more questions, feel free to ask, as I or other members will help you (I we can) Wink
Back to top
View user's profile Send private message Yahoo Messenger
mcbc



Joined: 21 May 2008
Posts: 12

PostPosted: Thu May 22, 2008 2:36 pm    Post subject: Re: Not validating emails. Reply with quote

Hey, thanks alot for the reply, it is working now, I spent quite a bit of time trying to get that to work. Thank you very much!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> HTML Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap