View Full Version : Javascript newsletter and email verify query

07-07-2011, 08:36 PM
long story short, I do work for a church, a charity asked me to fix some errors at their web site...1 problem arose and JavaScript is not my strong suite..they have an newsletter request form, just enter your email and your on their newsletter list, as you can see from the code below there is a problem, no valid email verify routine, if you just enter a space in the form, it will accept the info and send a blank request to the charity where an email addie should be... no clue how to fix, as I said javascript is not something I do at all....any help appreciated.



<script type="text/javascript">
$("#rform").submit(function(){return false;});
if($("input#s").val() != "" && $("input#s").val() != 'Enter Email Address'){
$.get("/rsignup.php?email="+$("input#s").val(), function(data){
} else {
alert('Please enter your email address to subscribe');
<!-- BEGIN Form -->
<div style="text-align: left;margin: 20px 0 -10px 10px;font-weight:bold;">Email Newsletter:</div>
<div id="newsletterdiv" style="height:25px;">

<form name="optin" action="#" onsubmit="return false;" method="post" style="margin-bottom:2;" id="newsletterform">
<input type="hidden" name="vff" value="103">
<input type="hidden" name="vpp" value="i">


<input value="Enter Email Address" onfocus="if (this.value == 'Enter Email Address') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Email Address';}" name="ea" id="s" type="text">
<input id="newslettersubmit" value=" " type="submit" name="go">

<!-- END Form -->