The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reCAPTCHA issue...
I'm setting up a test installation of FormTools 2, and all basic functionality is working as intended.

However, I'm running into an issue with implementing reCAPTCHA on a form. I'm following the instructions here:

Everything is working (the reCAPTCHA is added to the form, it's getting processed when entered correctly, etc...except that when the form gets submitted, if the reCAPTCHA is incorrectly entered, the form seems to refresh itself and all previously-entered data is cleared out.

So, I added bits of code along the lines of those mentioned in step #3 (re-entering fields), but no luck...nothing seems to happen.

Looking at the source code of the form after a submission of this type, it appears that any of the text fields that are supposed to be populated by this code (with the [] portion of the $fields section updated to reflect the field's name in my particular form):

<input type="text" name="first_name" value="<?=htmlspecialchars(@$fields["first_name"])?>" />

are instead coming in with null values (value="")

Similarly, the select fields that are supposed to be populated by this code (again, with the [] portion of the $fields section updated to reflect the field's name in my particular form)

<?php if ($fields["age"] == "Under 18") echo "selected"; ?>

are defaulting the initial entry in the select list as being "selected", regardless of which item was chosen prior to form submission.

And, I'm not seeing any error message or anything, despite the code for that being (supposedly) in place.

My FormTools 2 installation is completely up-to-date as of this afternoon, my server meets/exceeds all requirements, and I have updated my config.php with my reCAPTCHA info and whatnot.

Like I said earlier, the reCAPTCHA works fine if I enter it correctly...the form gets processed and I get an e-mail summarizing the submission as expected. It's only when the reCAPTCHA is entered incorrectly that things get a bit...wonky.

Any help would be greatly appreciated.


Doug Thompson
Manager of Web and Electronic Communications
Ohio Wesleyan University
Hi Doug,

Hmm... I think that this may be a problem with the tutorial. I'll just test it out now, but the PHP that appears at the top of the page doesn't look right to me...

Keep you posted.

- Be n
Hmmm.. curious! I tested it out and actually's it's working fine for me. That's not to say there's isn't a bug, though.

What happens is that when the CAPTCHA is entered incorrectly, process.php starts sessions, stores your form values and the error message and then redirects you back to the form page. By the looks of it, this mechanism isn't working on your server.

But here's a simple test. After the $fields = ... line at the top of your form page, right before the closing ?> tags, add this line:

PHP Code:

Then put through an invalid recaptcha. Do you just see Array( ) - or is it populated with content?

One other question: are you using the default PHP sessions, or database sessions? (if you haven't explicitly set it to use database sessions, it'll use PHP sessions).

- Ben
When I initially tried implementing this form, I was using a Form Tools 1.x form that I converted over to Form Tools 2.x with the Form Tools 1 Data Import Module. I decided to wipe that converted version out and creating a new form within Form Tools 2.x.

I followed along with the instructions from, hoping things would behave differently.

But, alas, they are behaving the same. When I enter a valid reCAPTCHA, the submission works as intended. When I enter an invalid reCAPTCHA, the page refreshes, the form fields clear out, and I don't see an error message of any sort.

When I View Source on the form page after putting that print_r line, I see:


At the top of the source code.

As for your questions about what kind of sessions I'm using, I can only assume I'm using the PHP sessions, as I don't recall (or know how to, really) changing anything relating to PHP sessions. How can I check to make sure?

Thanks for your ongoing help,
Same happened to me months ago, no response.

I tested the print fields command above. All I get is form id and submission id:
Array ( [form_tools_form_id] => 9 [form_tools_submission_id] => 106 )

I tried taking the $fields = ft_api… line and the $params = … out of the if (empty($errors)) statement, and nothing.

I tried removing the "finished" line, no success

The form submits fine if EVERYTHING is right, but any error, from captcha or validation doesn't return the data to the form.

My old un-resolved post with code is here
Hey guys,

Well, I must say I'm rather stumped on this problem. As mentioned, I tested everything through locally and I couldn't find any problems. For some reason, on your servers the process.php script just isn't properly storing information in sessions before redirecting back to the previous page. I can't see any reason why this occurs.

One thing you could possibly try is set your error reporting to 1. It's a small possibility that some sort or minor warning/notification is causing problems.... but it's a long shot.

Add this line to your /global/config.php file.

PHP Code:
$g_default_error_reporting 1

Sorry I can't be more help on this...

- Ben
Take a look at my thread. I think we're having the same issue. I have a solution, but I'm not sure if it's a good solution. I was hoping someone with formtools experience could chime in
Anyone get to the bottom of this? I am having the same issues here.

(Apr 2nd, 2010, 10:31 AM)filch Wrote: Anyone get to the bottom of this? I am having the same issues here.


Hi, I'm having the same issue: no reCAPTCHA error message, fields deleted, etc.

Any solution?
Tom --
+1 to this issue. Has anyone figured out what is going on with it?

Forum Jump:

Users browsing this thread: 1 Guest(s)