Empty the input fields of the form

What seems to be the problem:
I have a problem that I can’t solve all day. When using the @livewireScripts Directive, the form fields are cleared, but the values are in the field attributes. If you disable this Directive, the input fields remain filled in. The “value” attribute, however, is filled in with the required value in the developer tools. Please help with the solution. How do I leave the input fields filled in?

Steps to Reproduce:
Class:

class Zakazfl extends Component
{
    public $dog, $zakfl;
    public $fiopolnoefl,$adres,$emailfl,$telefonfl,$viddokumenta,$seriyadokumenta,$nomerdokumenta,$kemvydandokument,$datadok,$kodpodrazdel;
    protected $user;
    public function mount()
    {
        $this->dog = Dog::where('document_id', session()->get('iddoc'))->first();
        $this->zakfl = Zakfl::where('zakazchik_id', $this->dog->zakazchik_id)->first();
    }
    public function render()
    {
        return view('livewire.doc.dog.zakazfl');
    }
}

Form:

<form wire:submit.prevent="saveZakazchikFl" id="zakazchikFl" name="zakazchikFl">
    @csrf
    <div class="shadow overflow-hidden sm:rounded-md">
        <div class="px-4 py-5 bg-white sm:p-6">
            <div class="grid grid-cols-3 gap-2">
                <div class="col-span-1 sm:col-span-1">
                    <label for="fiopolnoefl" class="block text-sm font-medium leading-6 text-gray-700">Фамилия
                        Имя Отчество</label>
                    <input
                        class="mt-1 form-input block w-full py-2 px-3 border border-gray-300 rounded shadow-sm focus:outline-none focus:shadow-outline-blue focus:border-blue-500 transition duration-150 ease-in-out sm:text-sm sm:leading-5"
                        id="fiopolnoefl" name="fiopolnoefl" maxlength="100"
                        wire:model="zakfl.fiopolnoefl"
                        value="{{ !empty($zakfl->fiopolnoe) ? $zakfl->fiopolnoe:'' }}"
                        placeholder="Фамилия Имя Отчество">
                </div>{{ $zakfl->fiopolnoe }}
                
            </div>
        </div>
    </div>
</form>

Hi My Friend, when your process is finished you should do like this :
example you have $dog = “test” ; variable like this and your process is finished you should do $dog = “”; like this

$this->reset(); // to reset all fields in the form
$this->reset('zakfl'); // to reset a specific field

or you can try the traditional way

$this->zakfl = "";
3 Likes

Gives error foreach() argument must be of type array|object, null given