Find services - Discount Perfume - Record Songs for free - Debt Consolidation - Credit Reports

PDA

View Full Version : Can't seem to get this to work.


Kierslee
Aug 11th 2006, 10:42 am
I'm trying to write some javascript that will check the value of a user-entered email address. If the address matches one that I put in the code I want to redirect the customer. If the address does not match the one(s) in my script I want the function to continue to validate the form.

My problem is the function doesn't seem to care if the email address in the "email" field matches, the re-direct doesn't happen.

Can anyone make any suggestions to help me fix this?

Here is the code.


<script type="text/JavaScript">
//Script to verify that all necessary information has been added
function Verify(myForm)
{
if (myForm.email.value = (laset@nomail.de))
{
window.location="http://www.urlgoeshere.com/missing.html";
}
}
</script>




<form name="myForm" method="POST" action="http://urlgoeshere" onsubmit="return Verify(this);">
<input type="hidden" name="website" value="urlgoeshere">
<input type="hidden" name="subject" value="Product Review">
<input type="hidden" name="transtype" value="Non-Secure">
<input type="hidden" name="success" value="http://www.urlgoeshere.com/product-review-success.htm">

<input type="hidden" name="pagename" value="<?
if (isset($Product))
{
print $Product;
}
else
{
print "No product selected.";
}

?>">

<table cellpadding=2 cellspacing=2 border=0 align="left">
<tr>
<td colspan=3 align=center><h3>Submit a Product Review</h3><br></td>
<td rowspan=10 align="left" valign="top">

<b>Ideas for writing your review</b>
<li>What was your experience with this product?</li>
<li>Why did you purchase this product?</li>
<li>What do you like about this product?</li>
<li>What do you dislike about this product?</li></td>
</tr>
<tr>
<th align="right">* Product Name/Model</th>
<td colspan=2><input type="text" name="Model" size="40" maxlength="40"></td>
</tr>

<tr>
<th align="right">* Name</th>
<td colspan=2><input type="text" name="name" size="40" maxlength="40"></td>
</tr>
<tr>
<th align="right">Organization</th>
<td colspan=2><input type="text" name="org" size="40" maxlength="40"></td>
</tr>
<tr>
<th align="right">* E-mail Address</th>
<td colspan=2><input type="text" name="email" size="40" maxlength="40"></td>
</tr>
<tr>
<th align="right">Phone Number</th>
<td colspan=2><input type="text" name="phone" size="40" maxlength="40"></td>
</tr>

<tr>
<th align="right">* Review Body</th>
<td colspan=2><textarea name="reviewbody" ROWS=4 COLS=32></textarea></td>
</tr>

<tr>
<td colspan=3 align=center>
<input type="submit" value="Submit Product Review">
<br><br><br><br>
* Required fields.
</td>
</tr>

</table>
</form>

ClarkF1
Aug 11th 2006, 1:48 pm
Have you tried replacing the bracket with single quotation marks???

if (myForm.email.value = 'laset@nomail.de')

exam
Aug 12th 2006, 12:41 pm
Try comparing the two instead of assigning the value of one to the other
if (myForm.email.value == 'laset@nomail.de') {
alert ('email matched');
} Classic new programmer error :)