Closed BarsikCat closed 2 years ago
Hello, that's weird. Can you show how you create Recaptcha3Type, please?
Also, try going through the troubleshooting checklist. I'm sure there is some misconfiguration issue
Thanks for the reply!
I can easily misconfigure something because I am back to PHP after a long period of time. It looks pretty different for me :)
class ContactUsType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TextType::class, [
'label' => "Your name:",
'required' => false
])
->add('email', EmailType::class, [
'label' => "Your email address:",
'help' => "We'll never share your email with anyone else.",
'required' => false
])
->add('message', TextareaType::class, [
'label' => "Your message:",
'attr' => ['rows' => '7'],
])
->add('send', SubmitType::class, [
'label' => "Send Message",
])
->add('captcha', Recaptcha3Type::class, [
'constraints' => new Recaptcha3(),
'action_name' => 'contacts',
//'script_nonce_csp' => $nonceCSP,
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => ContactUs::class,
]);
}
}
namespace App\Entity;
class ContactUs
{
public string $captcha;
protected string $name;
protected string $email;
protected string $message;
public function getName(): string
{
return $this->name;
}
public function setName(string $name): void
{
$this->name = $name;
}
public function getEmail(): string
{
return $this->email;
}
public function setEmail(string $email): void
{
$this->email = $email;
}
public function getMessage(): string
{
return $this->message;
}
public function setMessage(string $message): void
{
$this->message = $message;
}
}
In your "the troubleshooting checklist" the Captcha setup picture is truncated. I have 3 checkboxes bellow. They are translated to my language but mean the following: Check reCAPTCHA solution source - Yes, Allow AMP-page - No, Report to owner - Yes
More pictures for you:
It is uploaded to a test domain and I can share GitHub repository with you.
All looks good. Please, share the repo
Invite sent. Complete newbie (in modern PHP) form processing realization made from current Symfony documentation.
thank you, I'll take a look tomorrow
On Fri, Oct 15, 2021, 1:15 AM BarsikCat @.***> wrote:
Invite sent. Complete newbie (in modern PHP) form processing realization made from current Symfony documentation.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/karser/KarserRecaptcha3Bundle/issues/48#issuecomment-943778973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMY6GOCNXI3DMRFQGZPFFLUG5JBJANCNFSM5F5PONUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Figured it out. You don't need $captcha property on ContactUs entity because Recaptcha3Type is not mapped That's what you need to do to make it work:
Many thanks!
Hello,
I'm continually getting "The captcha value is missing" message.
This is my first PHP project for more than a decade :)
The browser says that the form is successfully posted:
Form data:
But debug details look strange for me:
I can share the entire project :)