Open mahlasg81 opened 1 month ago
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:
How should I use Livewire 3? Please guide me
Hi My project is with Livewire I have added the library to the project This form code:
This livewire controller code:
When I click the submit button, I get the following error:![2121211121212121121000000](https://github.com/user-attachments/assets/1cfd2314-7ba5-4d7b-902a-839cb984bc11)
How should I use Livewire 3? Please guide me