F
Filament2w ago
Ali

Any idea how to show the "anhskohbo/no-captcha": "^3.6" on the last page of a wizard ?

I have tried countless times and used multiple packages and none of those display the captcha since the "page" changes
10 Replies
LeandroFerreira
difficult to assist you without any code..
Ali
AliOP2w ago
Thanks for your concern. So at first I tried using the "abanoubnassem/filament-grecaptcha-field": "^0.0.7" package on the last page of my wizard but when I get to it the captcha just disappears and I think it's because the form "changes" I think that's basic behaviour for google recaptcha.
No description
Ali
AliOP2w ago
Then I tried using the anhskohbo/no-captcha as the title says, I put an action trigger inside the wizard's submit button as this screenshot shows. The issue is that the captcha still doesn't show and I think it's because of the action modal animation changes.
No description
Ali
AliOP2w ago
This isn't the first time i get issues with recpatcha + filamentphp and my local govermenet insists on using google recpatcha on "official" websites. I have been making normal "forms" inside filamentphp projects just because of recaptcha compatibility with filament.
Ali
AliOP2w ago
Here's an example of I was doing before instead of using filament forms. It's unfortunate.
No description
Abdellah Belkaid
Hello @Leandro Ferreira , I'm facing the same exact issue as @Ali , please any idea how to resolve it?
toeknee
toeknee2w ago
I've got a feeling it won't work in a wizard since a wizard is validated on the step too. Which likely means the data is reset and the captcha isn't re-triggered and it load son dom
LeandroFerreira
@Ali @Abdellah Belkaid, try this package: https://github.com/DutchCodingCompany/livewire-recaptcha I think you are Adding a form to a Livewire component, right? Try this
public ?array $data = [];

public string $gRecaptchaResponse;

public function mount(): void
{
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->schema([
Wizard::make([
Wizard\Step::make('Step1')
->schema([
TextInput::make('field1')
]),
Wizard\Step::make('Step2')
->schema([
TextInput::make('field2')
])
])
->submitAction(new HtmlString('<button type="submit">Submit</button>')),
])
->statePath('data');
}

#[ValidatesRecaptcha]
public function create(): void
{
dd($this->form->getState());
}
public ?array $data = [];

public string $gRecaptchaResponse;

public function mount(): void
{
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->schema([
Wizard::make([
Wizard\Step::make('Step1')
->schema([
TextInput::make('field1')
]),
Wizard\Step::make('Step2')
->schema([
TextInput::make('field2')
])
])
->submitAction(new HtmlString('<button type="submit">Submit</button>')),
])
->statePath('data');
}

#[ValidatesRecaptcha]
public function create(): void
{
dd($this->form->getState());
}
<div>
<form wire:submit="create" wire:recaptcha>
{{ $this->form }}
</form>

@if($errors->has('gRecaptchaResponse'))
<div class="alert alert-danger">{{ $errors->first('gRecaptchaResponse') }}</div>
@endif

@livewireRecaptcha()
<x-filament-actions::modals />
</div>
<div>
<form wire:submit="create" wire:recaptcha>
{{ $this->form }}
</form>

@if($errors->has('gRecaptchaResponse'))
<div class="alert alert-danger">{{ $errors->first('gRecaptchaResponse') }}</div>
@endif

@livewireRecaptcha()
<x-filament-actions::modals />
</div>
GitHub
GitHub - DutchCodingCompany/livewire-recaptcha: Add Livewire reCAPT...
Add Livewire reCAPTCHA form validation to your components. - DutchCodingCompany/livewire-recaptcha
Abdellah Belkaid
Hello @LeandroFerreira thanks a lot for your help , I've tried to implement your solution in my code , but no success and then i have tried the same exact code you provided , still no success , the submit button is not submitting at all! also I have tried a wire:click , it submit , but no captcha or error appear 😢
No description
Ali
AliOP2w ago
@LeandroFerreira I have created an issue on this package here https://github.com/AbanoubNassem/filament-grecaptcha-field/issues/13, care to take a look on it ? I would love to PR a fix for it if you could enlighten why the recpatcha doesnt reset
GitHub
Issues · AbanoubNassem/filament-grecaptcha-field
Provides a Google reCaptcha V2 field for the Filament Forms(V2-V3), works in Admin-Panel and Forntend-Forms. - Issues · AbanoubNassem/filament-grecaptcha-field

Did you find this page helpful?