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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:59:46+00:00 2026-05-20T11:59:46+00:00

Wow, my first Stackoverflow post, I’ve been watching this site for ages .. anyway,

  • 0

Wow, my first Stackoverflow post, I’ve been watching this site for ages .. anyway, so Ive got a form, that I’m using Jquery to do some simple validation, and for some reason, even though the ‘return true’ is coming through, I tested it by putting an alert just before it. Heres my jquery, which isnt coming up with any errors:

            var captcha_def = 'Please copy the text';

        $('input[type="submit"]').click( function(x){
            x.preventDefault();
            var validated;

            $('.validate').each(function(){
                var content = $(this).val();
                if ( content == '' )
                {
                    $(this).addClass('error');
                    validated = 'false';
                }
                else
                {$(this).removeClass('error');}
            });


            $('#conf_email').each( function(){  //Just to check to make sure their is a Email Confirmation

                var email = $("#email").val();
                var conf_email = $('#conf_email').val();
                if (email != conf_email)
                {
                    $('#email, #conf_email').addClass('error');
                    validated = 'false';
                }
                else
                {
                    $('#email, #conf_email').removeClass('error');
                }
            });



                var captcha = $('#captcha_input').val();
                if (captcha == captcha_def)
                {
                    $('#captcha_input').addClass('error');
                    validated = 'false';
                }
            alert(validated);

            if (validated === 'false') 
            {
                return false;
                } 
            else
            {   
                return true;
            }

        });

and heres my html (which validates):

<form id='freeform' name='a' method="post" action="index.php"  >


    <div id="contact_form">
        <h2><span class="small-caps">Send</span> US AN <span class="small-caps">Email</span></h2>

        <label for="name_input" class="text">*Your Name:</label><input type="text" name="name" class="text validate" id="name_input" /><br />
        <label for="email_input" class="text">*Email:</label><input type="text" name="email" class="text validate email" id="email_input" /><br />
        <label for="ta_message" class="textarea">Your Message:</label><br />
        <textarea id="ta_message" name="message"></textarea><br />

        <label for="captcha_input" class="text"><img src="/images/captchas" width="140" height="30" style="border:0;" alt=" " /></label><input type="text" name="captcha" class="captcha text validate" id="captcha_input" /><br />

        <input type="submit" id="submit" value="Submit"> 
    </div>

I’ve been banging my head over this, and cant figure out what it is, and with a deadline looming, I’m trying to figure out what I messed up. Thanks you so much for any help!

  • 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-20T11:59:47+00:00Added an answer on May 20, 2026 at 11:59 am

    Why are you calling x.preventDefault() at the beginning without doing any validation at all? What about prevent the default behavior only when your validation fails?

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

Sidebar

Related Questions

trying to get my first windows form running with controls. I havent been able
Wow, I just got back a huge project in C# from outsourced developers and
Wow, it's hard to find a simple explanation to this topic. A simple many-to-many
WOW! That's a weird title, but I'm happy you're looking, cause I couldn't find
I've been evaluating various smart pointer implementations (wow, there are a LOT out there)
this is my first question here. I have the following jquery code: $(document).ready(function(){ $(a).click(function(){
Wow...I've never seen this before. Any way to get around it? foreach( double r
Wow, never thought I would ever write anything in DOS. Now that I do,
I send data from javascript to PHP like this: $.ajax({'url': 'my.php', 'type': 'POST', 'data':
I need to get the path to the native (rather than the WOW) program

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.