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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:03:50+00:00 2026-05-25T20:03:50+00:00

I am not sure what to do and why it is not working it

  • 0

I am not sure what to do and why it is not working it is my first attempt at something like this.

Here is a fiddle of it http://jsfiddle.net/ProjectV1/LVPtN/

You will notice in javascript I have a var error which is by default false.

If there is an error it is true.

I have displayed the value of error next to each input on my form.

If the variable error is false it should submit the form and false it shouldn’t.

The problem arises when an error occurs, and is then corrected the form will not submit.

Look at the fiddle. The form directs to google just for testing.

  • 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-05-25T20:03:51+00:00Added an answer on May 25, 2026 at 8:03 pm

    I think, the issue is with the error being inside the function which will be called on blur. And when the function call is done, it goes undefined. The deal is that the variable should be global. You will need to put this above the $(document).ready() This should work:

    var error = false;
    
    $('#joinForm input').blur(function() {
        var id = $(this).attr('id');
        var val = $(this).val();
        if (id == 'email') {
            $('#emailMsg').hide();
            if (val == '') {
                error = true;
                $('#' + id).after('<div id="emailMsg" class="error">' + error + '</div>');
            }
            else {
                $('#' + id).after('<div id="emailMsg" class="success">' + error + '</div>');
            }
        }
        if (id == 'cemail') {
            $('#cemailMsg').hide();
        }
        if (id == 'password') {
            $('#passwordMsg').hide();
            if (val == '') {
                error = true;
                $('#' + id).after('<div id="passwordMsg" class="error">' + error + '</div>');
            }
            else {
                $('#' + id).after('<div id="passwordMsg" class="success">' + error + '</div>');
            }
        }
        if (id == 'cpassword') {
            $('#cpasswordMsg').hide();
        }
        if (id == 'username') {
            $('#usernameMsg').hide();
            if (val == '') {
                error = true;
                $('#' + id).after('<div id="usernameMsg" class="error">' + error + '</div>');
            }
            else {
                $('#' + id).after('<div id="usernameMsg" class="success">' + error + '</div>');
            }
        }
        $('#joinForm').submit(function(){
            if (error == true) {
                return false;
            }
            else {
                return true;
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure why this isn't working. I don't have any errors, but what
Ok I'm working on getting better with python, so I'm not sure this is
First time using wordpress query so not sure how to handle this problem. I
I'm working on my first Android app and to be honest I'm not sure
I'm not sure why my code is not working.. I have code in vba
I'm working on a project which I'm really not sure how to unit test.
I am working with old ASP code and I am not sure about semantics
I am working on threading in MFC..I am not sure how to use threading..
I'm working on a GUI application in WxPython, and I am not sure how
I have the following Clojure code and I'm not sure why it's not working:

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.