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

  • SEARCH
  • Home
  • 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 8215023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:39:10+00:00 2026-06-07T11:39:10+00:00

I have a Javascript file that I use to check the input of a

  • 0

I have a Javascript file that I use to check the input of a form. However, when I uncomment the commented line, the javascript file does not function properly, and the form is submitted even if some of the fields are blank. In fact, the Javascript file doesn’t even make it to the second alert function. What is going on?

function checkLogin()
{
    alert("HERE");
    //document.getElementById("errors").style.display = "none";
    var form = document.getElementById("form1");
    var problems = false;
    document.getElementById("errorJS").style.display = "none";
    document.getElementById("errorJS").innerHTML = "";
    alert("test");
    if(form.email.value.length < 1)
    {
        document.getElementById("errorJS").innerHTML += "Please enter your email address. <br />";
        problems = true;
        document.getElementById("errorJS").style.display = "block";
    }
    if(form.pword.value.length < 1)
    {
        document.getElementById("errorJS").innerHTML += "Please enter your password.";
        problems = true;
        document.getElementById("errorJS").style.display = "block";
    }
    alert(!(problems));
    return !(problems);
}

That was it, the line was returning null. Thank you for the answers.

  • 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-07T11:39:11+00:00Added an answer on June 7, 2026 at 11:39 am

    Though you don’t exactly define what “does not function properly” means, and you have provided no error info (which the browser surely supplied to you), I would say that document.getElementById("errors") is returning null. This would mean that no element exists in your document with the ID of errors.

    A check of whether document.getElementById("errors") returned something usable before attempting to access properties thereon would be a good step forward. Ensuring your document is as you assume it to be would be another.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Javascript function that sends username and password to php file through
i have the following function in jQuery and javascript that creates a form element:
I know that .append() does not have any callback function, but when I try
I have a JavaScript file that prints the title attribute of the child img
I have a JavaScript file that I ran through the Google Closure compiler, and
I have a lengthy JavaScript file that passes JSLint except for used before it
I have a simple JavaScript file that has three jQuery $document.ready functions. All three
I have a HTML that includes a Javascript file. This script contains a special
I have a php file that returns a div and a javascript. I want
I have a node.js (v0.6.12) application that starts by evaluating a Javascript file, startup.js.

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.