Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

JavaScript Basic basic javascript form validation. literally need an help

  1. Apr 23, 2012 #1
    Javascript is in an external file liked by this:
    <script type="text/javascript" src="myscript.js"></script>
    in the head tag

    i have
    <form name="myform" action="" method="POST" onSumbit="return validateForms()">
    and some form stuff and then:
    <input type="submit" value="Submit" onclick="calculate()" />

    in the javascript function i have this,


    function validateForms(){
    alert("form will be checked");

    var x=document.forms[myform]["firstname"].va…
    if (x==null || x==""){
    alert("First name must be filled out");
    return false;
    }
    }

    WHY THE HECK IS THIS NOT WORKING!
     
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted