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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:12:15+00:00 2026-05-19T04:12:15+00:00

I have some strange issue using jQuery Validation plugin. Firs of all here is

  • 0

I have some strange issue using jQuery Validation plugin. Firs of all here is my code:

formvalid.js

var v = jQuery("#sendform").validate({
        rules: {
            /* some other rules */
            captcha: {
                required: true,
                remote: "securimage/process.php"
            }
        },            
        messages: {
            /* some other messages */
            captcha: {
        required:"Security code is required",
        remote:"Security code is incorrect!"
        }
        }
    });

process.php

<?php
/* I tried with and without session_start(). 
Both ways works with same probelm (read next)*/
//session_start();
include_once '../securimage/securimage.php';

$securimage = new Securimage();

if ($securimage->check($_GET['captcha']) == false) 
    echo "false";

else
    echo "true";
?>

sendform.php

<?php
include_once 'securimage/securimage.php';

//echo $_POST['captcha'];

$securimage = new Securimage();
//echo "<br/>".$securimage->getCode();

if($_POST['captcha'] && $securimage->check($_POST['captcha']))
{
    //do sending
}
?>

So, the problem is when I’m checking security code with AJAX request, ajax works fine, but when I’m send the form, $securimage->check($_POST['captcha']) in sendform.php returns false. Then I tried to disable remote capctha validation and viola $securimage->check($_POST['captcha']) in sendform.php returned true!

As you can see I echo some values in sendform.php and result is:

Case #1: AJAX captcha validation enabled.

Results:

echo $_POST['captcha'];               // User_input_value;
echo $securimage->getCode();          // nothing
$securimage->check($_POST['captcha']) // false

Case #2: AJAX captcha validation disabled.

Results:

echo $_POST['captcha'];               // User_input_value;
echo $securimage->getCode();          // code from image
$securimage->check($_POST['captcha']) // true (if equals)

Anyone know how to make it work?

Thanks for any advice.

  • 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-19T04:12:15+00:00Added an answer on May 19, 2026 at 4:12 am

    Almost same question was asked a while ago, it seems that the captcha is resetting after each check.

    What I suggest is to have a flag in your session that you would set to TRUE in your process.php after a valid captcha and then checking it instead of $securimage->check($_POST['captcha']) in your sendform.php:

    if ($securimage->check($_GET['captcha']) == false) {
        $_SESSION['valid'] = FALSE;
        echo "false";
    } else {
        $_SESSION['valid'] = TRUE;
        echo "true";
    }
    

    And:

    if($_POST['captcha'] && isset($_SESSION['valid']) && $_SESSION['valid']) // set it back to false inside this!
    

    Now here are two notes:

    • Since you are having two separate calls, some one can still change the captcha between the two calls
    • Since it’s only a captcha and you most probably is using it to prevent spam, I wouldn’t bother using the technique I posted above! actually I wouldn’t even bother doing another captcha check in the sendform.php

    Of course someone could spam you, but then and if you really need to use Ajax, then you have to stop processing the captcha in the jQuery plugin and just validate it when you submit your form, just like the original documentation approach.

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

Sidebar

Related Questions

I have a strange issue with an Asp.NET MVC application. Using Asp.NET MVC 3
I have a very strange issue with Daylight Savings Time (DST) in my app.
I'm having a strange issue with some @font-face text where there is some strange
Suppose you have a text file like: my_setting = ON some_method = METHOD_A verbosity
I'm trying to get a simple Lift example running and I'm having a strange
I have a Python script that uses Python version 2.6 syntax (Except error as
Here's the message I get when trying to install in via cabal-install: $ cabal
I just observed a strange behaviour (of course Oracle is probably supposed to behave
My iPhone app creates PDF files (in Arial font). The plain iPhone 3.1.x version
We are building a (Java) web project with Eclipse. By default Eclipse uses Cp1252

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.