2 Posts
EWG65
8 years ago
2
Topic

Hello!
Has faced the following problem.
When on a site two different forms containing two different fields Captcha Math are simultaneously open, at sending of one of forms there is an error. The matter is that expressions in different fields different, and the answer is required from one of fields for both cases. That is, in the second form it is necessary to write the answer to expression from the first form.

Get a Book for SEBLOD
2 Posts
EWG65
8 years ago
0
Level 1

Hi All!

I have found the reason on which two or more forms containing a field captcha math, on one page incorrectly worked.

The reason in that from Prepare Form through session two global variables - a field name captcha and the correct result connected with this name were transferred.

As a result, Prepare Store received a name and result of last opened captcha.

If a name not to transfer through session, and to take from parametres Prepare Store the correct result receives from the necessary global variable.

Here that for this purpose it is necessary to make in a file /plugins/cck_field/captcha_math/captcha_math.php

1. In section onCCK_FieldPrepareForm - Set it is necessary to remove a line 112

$session->set( 'secure_cckaptcha', $name );

2. In section onCCK_FieldPrepareStore - Validate Captcha it is necessary to replace a line 169

$captcha = $session->get( 'secure_cckaptcha' );

For the line

$captcha = $name;

Then two or more forms with captcha math on one page will work correctly provided that for each form the field captcha with the unique name will be created.

4229 Posts
Kadministrator
8 years ago
0
Level 1

Thank you for your report and solution, I added it to the github https://github.com/Octopoos/SEBLOD/issues/154

Get a VIP membership