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

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

Open
itsnoman opened this issue May 22, 2023 · 1 comment

Comments

@itsnoman
Copy link

itsnoman commented May 22, 2023

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">

@Khadreal
Copy link

Khadreal commented Jul 31, 2024

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
    }

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

2 participants