Ok..I know it's Friday, it's late, I'm ready for a Yuengling or three ;-),
but this piece of javascript is interfering with my Yuengling consumption, I
have the following validation bit but it just blows past the script even
when fields are empty ;( 
 
<script type=text/javascript>
 function validateForm() {
  var allOk = true;
  var errorString = "Please fix the following before submitting:\n";
  
  // require a name before processing the request
  if (!document.commentsForm.fullname.value) {
   allOk = false;
   errorString += "\n- Please enter your full name";
  }
  // validate their email
  var validEmail =
/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  if (!validEmail.test(document.commentsForm.emailaddr.value)) {
   allOk = false;
   errorString += "\n- Please enter a valid email address.";
  }
  // require some comments or questions in textarea
  if (!document.commentsForm.comments.value) {
   allOk = false;
   errorString += "\n- Please enter your comments or questions.";
  }
  if (!allok)  
  {
   alert(errorString);
   return false;
  }
 
  return allOk;
 }
</script>
 
it's being called from 
 
<form name="commentsForm" action="#self#?fuseaction=comments.viewComments"
method="post" enctype="multipart/form-data" onsubmit="return
validateForm(this);">
   <input type="text" name="fullname" size="25" maxlength="75" value="" />
   <input type="text" name="emailaddr" size="25" maxlength="75" value="" />
   <input type="text" name="city" size="20" maxlength="75" value="" />
   <input type="text" name="state" size="2" maxlength="2" value="" />
   <textarea name="comments" cols="45" rows="6"></textarea>
  <input type="submit" name="submit" value="Send Message" />   <input
type="reset" name="reset" value="Clear Form" />  
</form>
but it blows right past it...any pointing out of the obvious is welcomed ;)
and I'm sure it's something simple .... just can't see it atm.
 
Bob


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2056
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to