Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.

there is no way to reset the inputs values ? #17

Open
hemant17 opened this issue Jun 27, 2020 · 1 comment
Open

there is no way to reset the inputs values ? #17

hemant17 opened this issue Jun 27, 2020 · 1 comment

Comments

@hemant17
Copy link

when users click on save it's should clear the values of input after the summit to DB is that possible?

@papalardo
Copy link

Solution:

$ php artisan vendor:publish --tag=form-views
{{-- resources/views/vendor/laravel-livewire-forms/form.blade.php --}}
<div class="row">
    <div class="col-md offset-md-2">
        <button class="btn btn-primary" wire:click="saveAndStay">{{ __('Save') }}</button>
        <button class="btn btn-primary" wire:click="resetForm">{{ __('Reset') }}</button>
        {{-- <button class="btn btn-primary" wire:click="saveAndGoBack">{{ __('Save & Go Back') }}</button> --}}
    </div>
</div>
// FormComponent.php
public function resetForm() 
{
    $this->form_data = [];
}

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

No branches or pull requests

2 participants