Click to See Complete Forum and Search --> : Having trouble with validation checking


rekuyki
05-26-2004, 08:34 AM
hello everyone,

right now i am haveing a problem with my function validation to check my form. i just wantit to check the email to make sure there is something in there and it contains an @ sign. Here is my code


function validate()
{
searchString = document.subscribe.Email.value;
result = searchString.search("@");
if (result == -1) {
alert("You must enter a valid email address. Please try again.");
document.subscribe.Email.focus();
return false;

</SCRIPT>

that is in the head and for the form the code is as follows

<FORM NAME="subscribe" onSubmit="return validate();"
ACTION="http://dev.myloadspring.com/chris' test/process_new_subscriber.asp" METHOD="POST">
<IMG SRC="images/subscribe.gif">
<P>Enter your email address to subscribe to our quarterly news letter</P>
  <INPUT TYPE="TEXT" NAME="Email" SIZE="25">
<BR>
  <Input type="SUBMIT" VALUE="Submit">


your help will be greatly appreciated

LeeU
05-26-2004, 09:20 AM
Wouldn't it just be easier to use an existing script? Check out the following:

ScriptSearch.com (http://www.scriptsearch.com/JavaScript/Scripts/Forms/)

and

The JavaScriptSource.com (http://javascript.internet.com/forms/)

Lee