You are not logged in.
Pages: 1
Hello,
I added the reCaptcha field to a form but when I go to the form, all I get is the text
Spam Prevention *
Please help us prevent spam by using the reCAPTCHA below.
I added the site key and secret key in the settings.
When I inspect the field, the data-sitekey is empty and in the console, it is showing an error: Uncaught Error: Missing required parameters: sitekey
Is there something else I need to do to make it work?
Thanks
Doon
Offline
If you have a custom Form Builder template (for drawing on the front end) you may need to modify the call to get the setting to explicitly ask for the extension version.
Modify this line (in _header.php in the template):
$settings = $cms->getSetting("settings");
to
$settings = $cms->getSetting("com.fastspot.form-builder*settings");
Offline
Thanks Tim!! That fixed the issue.
Doon
Offline
Hi Tim,
I have the similar issue with reCaptcha and I checked the _header.php in the template folder but I couldn't find it. Would you point me where is this file. I found two _header.php files, one in /core/admin/layouts/ and the other in /templates/routed/directory/. Both of those files don't show the line of code that should be modified as you mentioned above.
Would you point me to the right folder or a path to the file?
Thanks,
Offline
The correct _header.php file should be located in this location: extensions/com.fastspot.form-builder/templates/routed/btx-form-builder/
The one in /core/admin/layouts/ is for the header in the BigTree admin.
The one in /templates/routed/directory/ is for the header of your "Directory" template.
Offline
If you're using the extension version, jmason03 is correct about the location of the _header.php file in question.
If you're using a custom form builder template (e.g. there's something like /btx-form-builder/ inside of /templates/routed/) then you'll want to look in /templates/routed/btx-form-builder/ and make the getSetting adjustment I mentioned on November 9th.
The reason for this is that when in extension context (loading a template from the /extensions/ directory) BigTree does extension ID inference on calls to getSetting. That allows you to use getSetting("my-setting") within your extension and automatically reference the setting included by your extension. When the template is copied outside of the /extensions/ directory it can no longer do the ID inference and it needs an explicit extension namespace applied to the getSetting call (in this case, the namespace is com.fastspot.form-builder).
Offline
Thanks, I found it!
Here's the edited line:
//$settings = $cms->getSetting("settings"); KE NNA FELA
$settings = $cms->getSetting("com.fastspot.form-builder*settings");
But still the reCaptcha doesn't work. Please, see the screenshot link below.
https://pasteboard.co/Hhdalyd.png
Last edited by mke18 (April 18, 2018 12:05pm)
Offline
What do you get when you var_dump $settings?
Offline
I don't seem to see anything unless I'm doing something wrong. Also, this is what I see on the Console:
Uncaught Error: Missing required parameters: sitekey
at new Tq (VM3395 recaptcha__en.js:378)
at new tr (VM3395 recaptcha__en.js:386)
at Gr (VM3395 recaptcha__en.js:398)
at VM3395 recaptcha__en.js:398
Offline
var_dump should show something like "null" even if the setting is empty, but if it has content it should have a bunch of text output.
Offline
So, I put the var_dump below this $settings = $cms->getSetting("com.fastspot.form-builder*settings");
Offline
When I add the var_dump on the head.php, I get bool(false).
Offline
A "false" response means that the requested setting is not in the database.
Offline
Here's the var_dump results:
array(4) { [0]=> string(0) "" ["accept_payments"]=> string(0) "" ["no_css"]=> string(0) "" ["recaptcha"]=> array(2) { ["site_key"]=> string(40) "" ["secret_key"]=> string(40) "" } }
Offline
That result looks like a properly returning settings array. The next step would be to try to figure out why the draw file for the captcha isn't reading $settings properly.
Offline
Tim,
When I take off the reCapture form element, I don't see the error on the Console like below:
Uncaught Error: Missing required parameters: sitekey
at new Tq (VM3395 recaptcha__en.js:378)
at new tr (VM3395 recaptcha__en.js:386)
at Gr (VM3395 recaptcha__en.js:398)
at VM3395 recaptcha__en.js:398
So, could this be the js conflicts?
Offline
It is unlikely to be a Javascript conflict. The Javascript error is reporting that the sitekey is missing, so it is likely that the data-sitekey attribute of the reCAPTCHA container is not drawing properly.
Offline
How can we fix this? Is there's something to be done here on the draw/captcha:
<label>
<?=htmlspecialchars($field_data["label"])?>
<span class="form_builder_required_star">*</span>
</label>
<?php
}
if ($field_data["instructions"]) {
?>
<p><?=htmlspecialchars($field_data["instructions"])?></p>
<p><?=htmlspecialchars($field_data["recaptcha"])?></p>
Offline
What I don't get is that, when I add this: <div class="g-recaptcha" data-sitekey="with-my-site-key"> </div> on the WYSIWYG and reCaptcha image appear and works (meaning I can click and verify). However, it doesn't work on the form builder element.
See here:
https://pasteboard.co/Hhw7RxB.png
https://pasteboard.co/Hhw82QD.png
https://pasteboard.co/Hhw87i4.png
Offline
Hello,
It looks like it is getting your site key in var_dump of $settings. Can you confirm your draw/captatcha.php file data-sitekey has the echo below?
data-sitekey="<?=$settings["recaptcha"]["site_key"]?>"
If it does, can you try removing <?=$settings["recaptcha"]["site_key"]?> and just entering your site key and see if that shows up on the form?
Last edited by doon.mok (April 23, 2018 2:15pm)
Offline
Morning!
Thanks for your suggestion. Yes, I did made the edits and now the reCaptcha shows up but it keeps giving an error saying: "The code you entered was not correct. Please try again." Also showing that I'm missing a required field but I have four field and they are not required fields at all.
Offline
You'll also want to update the /process/captcha.php file to include your secret key if it's not loading through the setting.
Offline
Thanks everyone!
Made those changes on /process/captcha.php and it seems to be working and I can preview the form entries.
Thanks!
Offline
Pages: 1