Panneau N0C 04 EN 250 250
Get 15% discount on our partner PlanetHoster with the code PHA-ceikay

Captcha CK in a Joomla+Bootstrap page

More
1 year 3 months ago #74821 by ClaudioRomeo
I am using Captcha CK on a Joomla 5.3.2 + Bootstrap website.I have created a page with numerous fields to ask my customers for their billing information.I used PHP and Bootstrap, with Sourcerer (by Regular Labs). Everything works perfectly: the data is sent, the success message appears, the administrator receives the data, and the sender receives their copy (if requested).However, I am unable to integrate Captcha CK. This is not a contact form, so I used PHP to insert Captcha CK into the page:
Code:
\Joomla\CMS\Plugin\PluginHelper::importPlugin(“captcha”); $captcha = \Joomla\CMS\Captcha\Captcha::getInstance(“captchack”); echo $captcha->display(“captcha”, “BillingData”, “form-control”);
Verification (server-side, before sending email):
Code:
\Joomla\CMS\Plugin\PluginHelper::importPlugin(“captcha”); $captcha = \Joomla\CMS\Captcha\Captcha::getInstance(“captchack”); if (!$captcha->checkAnswer(null)) { // error }
I also tried the event:
Code:
$results = \Joomla\CMS\Factory::getApplication()->triggerEvent(“onCheckAnswer”, [“BillingData”]);
The captcha appears regularly, but the verification always fails.Now I have two questions:1. Is there a way to call Captcha CK and use it on a custom page?2. Alternatively, can you define a Captcha CK module to insert as you wish?

Joomla 5.3.2, PHP  8.3.21, Captcha CK 2.0.1

Counselor for better people in a better company

Please Log in or Create an account to join the conversation.

More
1 year 3 months ago #74822 by ced1870
Hi
this is not related to Captcha CK, this is related on how to integrate a captcha validation in a form with Joomla

You can check in my code how I do it in the contact form for Page Builder CK :
www.dropbox.com/scl/fi/jnq8iwvn5d725n3gs...url1p6sof089c2i&dl=0

contact2.php >> line 260 the lines used to load the captcha in the form

contact2helper.php >> line 48 the lines used to make the verification for the form submission

CEd

Joomlack Webmaster and Developer

Please Log in or Create an account to join the conversation.

More
1 year 3 months ago #74823 by ClaudioRomeo
Thank you so much!

Counselor for better people in a better company

Please Log in or Create an account to join the conversation.

Time to create page: 0.191 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 2463 guests and 3 members online