Results 1 to 2 of 2

Thread: validation help

  1. #1
    usiski Guest

    validation help

    I was wondering whats wrong with my script because its not working and i can't figure it out? I had just the email part first and that was working then I added the other stuff to check the rest and now none of it works. I only works with just the email validation.

    Any help will be appreciated, thanks.

    HTML Code:
    <script type="text/javascript">
    function checkForm()
    {
    var cname, cmessage,
    with(window.document.contact)
    {
    cname = name;
    cmessage = message;
    }
    if(cname.value == '')
    {
    alert('Please enter your name!');
    cname.focus();
    return false;
    }
    if (cmessage.value == '')
    {
    alert('Please enter your first name!');
    cmessage.focus();
    return false;
    }
    }
    <!--
    function emailcheck(cur)
    {
    var string1=cur.email.value
    if (string1.indexOf("@")==-1)
    {
    alert("Please input a valid email address!")
    return false
    }
    }
    //-->
      </script>
    Last edited by Alan; 02 Apr 2010 at 02:08 PM. Reason: fixed html tags

  2. #2
    MichelCarroll Guest
    I believe I spotted the problem.

    This line:

    HTML Code:
    var cname, cmessage,
    ..should be this:


    HTML Code:
    var cname, cmessage;

Similar Threads

  1. My Input Validation Code causing Errors...
    By oddball25 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 25 Jan 2010, 09:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •