Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No property found for validation: [g-recaptcha-response] in Livewire3 #195

Open
mahlasg81 opened this issue Jul 19, 2024 · 2 comments
Open

Comments

@mahlasg81
Copy link

Hi
My project is with Livewire
I have added the library to the project
This form code:

<form id="contact_form" wire:submit="save" method="post" id="dreamit-form" class="@if ( Config::get('app.locale') == 'fa') text-right @endif">
                            @csrf
                            <div class="row">
                                <div class="col-lg-6">
                                    <div class="form_box mb-30">
                                        <input type="text" wire:model="name"  placeholder="{{ __('messages.contactPage_form_input_fullname') }}" >
                                        @error('name') <span class="text-danger">{{ $message }}</span> @enderror
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form_box mb-30">
                                        <input type="email" wire:model="email" placeholder="{{ __('messages.contactPage_form_input_email') }}" >
                                        @error('email') <span class="text-danger">{{ $message }}</span> @enderror
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form_box mb-30">
                                        <input type="text" wire:model="phone" placeholder="{{ __('messages.contactPage_form_input_phone') }}" >
                                        @error('phone') <span class="text-danger">{{ $message }}</span> @enderror
                                    </div>
                                </div>

                                <div class="col-lg-12">
                                    <div class="form_box mb-30">
                                        <textarea wire:model="message" id="message" cols="30" rows="10" placeholder="{{ __('messages.contactPage_form_input_message') }}" ></textarea>
                                        @error('message') <span class="text-danger">{{ $message }}</span> @enderror
                                    </div>

                                    <div class="recaptch">
                                        {!! app('captcha')->display() !!}
                                    </div>

                                    <div class="quote_btn">
                                        <button class="btn" type="submit">{{ __('messages.contactPage_form_btn_submit') }}</button>
                                    </div>
                                </div>

                            </div>
 </form>

This livewire controller code:

class ContactForm extends Component
{
    public $name;
    public $email;
    public $phone;
    public $message;

    protected $rules = [
        'name' => 'required',
        'email' => 'required|email',
        'phone' => 'required',
        'message' => 'required',
        'g-recaptcha-response' => 'required|captcha'
    ];

    public function render()
    {
        return view('livewire.contact-form');
    }


    public function save(){
        $this->validate();
        Contact::create([
            'name' => $this->name,
            'email' => $this->email,
            'phone' => $this->phone,
            'message' => $this->message,
        ]);
        session()->flash('status', 'Thanks!');
    }
}

When I click the submit button, I get the following error:
2121211121212121121000000

How should I use Livewire 3?
Please guide me

@akzize
Copy link

akzize commented Oct 11, 2024

did you find any solution ??

@StevyMarlino
Copy link

any solution here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants