laravel-tel-input icon indicating copy to clipboard operation
laravel-tel-input copied to clipboard

I am using a livewire component but i am not able to populate data in the fields and in the flags as well

Open itsnoman opened this issue 1 year ago • 1 comments

Here is my PHP class code. public function mount() { $this->data['country_code'] = str_replace("+","",optional(user())->country_code); $this->data['phone_no'] = str_replace(optional(user())->country_code,'',optional(user())->phone_no); $this->data['full_no'] = optional(user())->phone_no; }

Here is my livewire blade component <x-tel-input wire:model="data.phone_no" id="phone" name="phone" class="form-input" /> <input wire:model="data.country_code" type="hidden" id="phone_country" name="phone_country">

itsnoman avatar May 22 '23 10:05 itsnoman

Having a similar issue, when the form is submitted to the livewire component, I'm getting empty for the model. were you able to resolve this ? @itsnoman

@victorybiz please any idea why this might be happening ? Here is a snippet

Blade

<x-tel-input
            wire:model.live="phone"
            value="{{ $number }}"
            id="phone"
            name="phone"
            class="form-input"
        />
        <input wire:model="phone_country" type="hidden" id="phone_country" name="phone_country">

Component

public function save()
    {
        $this->validate();

        var_dump($this->phone); var_dump($this->phone_country);// this is returning empty string
        $this->successMessage = 'Thank you for this';

        //Clear fields
        $this->reset(['number', 'message']);
        //return links preview link and shortlink option
    }

Khadreal avatar Jul 31 '24 09:07 Khadreal