Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9246899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:36:06+00:00 2026-06-18T09:36:06+00:00

i can not figure out why my function is failing to be called by

  • 0

i can not figure out why my function is failing to be called by my html form on submit. when i place the javascript directly in the head it works fine, but when it is in its own .js file it doesnt.

my validate.js

function validateForm()
{
if (document.forms[0].myName.value == "" )
    {alert("Name field cannot be empty.");
        return false;
   } // end if
   if (document.forms[0].myEmail.value == "")
   {
  alert("Email field cannot be empty");
  return false;
   }  // end if
   if (document.forms[0].myJob.value == "")
   {
        alert(" Job Description cannot be empty");
    return false;
}//end if
   if (document.forms[0].myPhone.value == "")
   {
        alert(" Phone Number cannot be empty");
        return false;
    }//end if
   alert("Name, email, job description and phone number are valid.");
   document.forms[0].myName.value = document.forms[0].myName.value.toUpperCase();
   return true;
} // end function validateForm

And my HTML

<title>Pasha the Painter Estimates</title>
<link href="painter.css" rel="stylesheet" type="text/css" />
<link href="favicon.ico" rel="icon" type="images/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type=“text/javascript” src=“validate.js”></script>
</head>
<body> 
<div id="container">
<h1 id="logo"><img src="painterlogo.gif" alt="Pasha the Painter" width="620" height="120" /></h1>
<div id="leftcolumn">
  <ul>
     <li><a href="index.html">Home</a></li>
     <li><a href="services.html">Services</a></li>
     <li><a href="testimonials.html">Testimonials</a></li>
     <li><a href="estimates.html">Estimates</a></li>
  </ul>
</div>
<div id="rightcolumn">
  <p>Request a Free Estimate.</p>
  <form method="post" action="http://webdevfoundations.net/scripts/painter.asp" onsubmit="return validateForm();">
    <div class="myRow">
        <label class="labelCol" for="myName">Name: </label>
        <input type="text" name="myName" id="myName" /> 
    </div>
    <div class="myRow">
        <label class="labelCol" for="myEmail">E-mail: </label>
        <input type="text" name="myEmail" id="myEmail" />
    </div>
    <div>
        <label class="labelCol" for="myJob">Description </label>
        <textarea name="myJob" id="myJob" rows="2" cols="20"></textarea>
    </div>
    <div>
        <label class="labelCol" for="myPhone">Phone Number: </label>
        <input type="text" name="myPhone" id="myPhone" />
    <div class="mySubmit">
        <input type="submit" value="Free Estimates" />
    </div>
  </form>
  <div id="footer">Copyright &copy; 2011 Pasha the Painter<br />
  <a href="mailto:yourfirstname@yourlastname.com">yourfirstname@yourlastname.com</a>
  </div>
</div>
</div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:36:07+00:00Added an answer on June 18, 2026 at 9:36 am

    You’re using the wrong quotes signs:

    <script type=“text/javascript” src=“validate.js”></script>
                 ^               ^     ^           ^
    

    Should be:

    <script type="text/javascript" src="validate.js"></script>
                 ^               ^     ^           ^    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can not figure out the syntax for this. Here's my code: $('select[id^=lookup_]').change(function() {
I can not figure out why my rich:dataTable is not rendering. I am using
I have something of a logical puzzle I can not figure out. I have
For the life of me, I can not figure out why some styles are
I use a Mahout (version 0.8) and MySQL. I can not figure out how
I have to implement simple ray tracing algorithm, but I can not figure out
I can not seem to figure out how to count the number of seconds
I can not for the life of me, figure out how I can reposition
Can someone figure out how to get rid of the NOT EXISTS statements in
I can't figure out why jquerymobile does not correctly display in xCode4's i0s simulator

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.