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 8078151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:42:02+00:00 2026-06-05T15:42:02+00:00

I have a simple html login form which is validated with javascript before its

  • 0

I have a simple html login form which is validated with javascript before its submitted. When I attempt to submit the form with the validation conditions unmet I get my validation alerts as per usual. However when they are met the submit button becomes unresponsive.

Here’s the html code for the form:

<form action="staff_login_process.php" class="myform" enctype="multipart/form-data" method="post" onsubmit="return validLog()">

            <fieldset>

            <div id="apply_width">

                    <div id="field_area">

                            <h2 class="white">Login</h2>

                                <label for="username">Username<span>*</span>
                                </label> <input type="text" name="email" value="" id="username" class="float_right" />

                                <label for="password">Password<span>*</span>
                                </label><input type="password" name="password" value="" id="password" class="float_right" />
                                <a class="red" href="">Forgot Password</a>

                    </div>

                    <input type="submit" value="Login" class="button" />

            </div>

            </fieldset>

        </form>

and here’s the Javascript code which takes care of the validation:

function validLog() {

var username = document.getElementById('username');
var password = document.getElementById('password');


if(notEmpty(username, "Please enter username")){
    if(notEmpty(password, "Please enter password")){
    }
}

return false;

} 

function notEmpty(elem, helperMsg){
if(elem.value.length == 0){
    alert(helperMsg);
    elem.focus(); // set the focus to this input
    return false;
}
return true;
}

I’m at a loss for what to try to get this working and can’t spot where I’ve gone wrong here so any advice would be great.

Thanks

  • 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-05T15:42:04+00:00Added an answer on June 5, 2026 at 3:42 pm

    Your validLog() function ALWAYS returns false

    Change

    if(notEmpty(username, "Please enter username")){
        if(notEmpty(password, "Please enter password")) {
            return false;
        }
    }
    
    return true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So for example I have a simple HTML form: <h3> <a href=#>Login</a> </h3> <div
I have a login form, which contains simple text box, that shows the text
There are some HTML based games (ie bootleggers.us) that have a simple login form
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have a simple html form. This form has a specific width and margin
I have a simple HTML Form with one column having a select menu with
I have a simple html form that looks like the following <form action=search.php method=get>
I have a simple html form with few fields in it. I wanted to
I have a simple form for a login, and I want to display the
I would like to have a simple login form (or any form for that

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.